const nntrainer::WeightRegularizer &value) const {
return value != nntrainer::WeightRegularizer::UNKNOWN;
}
+
+FlipDirection::FlipDirection(FlipDirectionInfo::Enum value) { set(value); }
} // namespace props
static const std::vector<std::pair<char, std::string>>
*/
class FlipDirection final : public EnumProperty<FlipDirectionInfo> {
public:
+ FlipDirection(FlipDirectionInfo::Enum value =
+ FlipDirectionInfo::Enum::horizontal_and_vertical);
using prop_tag = enum_class_prop_tag;
static constexpr const char *key = "flip_direction";
};
}
void PreprocessFlipLayer::forwarding(RunLayerContext &context, bool training) {
- props::FlipDirection flipdirection =
- std::get<props::FlipDirection>(preprocess_flip_props);
+ props::FlipDirectionInfo::Enum flipdirection =
+ std::get<props::FlipDirection>(preprocess_flip_props).get();
if (!training) {
for (unsigned int idx = 0; idx < context.getNumInputs(); idx++) {
return;
}
+ float random_translate =
+ std::get<props::RandomTranslate>(preprocess_translate_props);
for (unsigned int idx = 0; idx < context.getNumInputs(); idx++) {
Tensor &hidden_ = context.getOutput(idx);
Tensor &input_ = context.getInput(idx);
const TensorDim input_dim = input_.getDim();
- float random_translate =
- std::get<props::RandomTranslate>(preprocess_translate_props);
if (random_translate < epsilon) {
hidden_ = input_;
--exclude "*/test/*" \
--exclude "*/meson*/*" \
--exclude "*/nntrainer_logger.cpp" \
- --exclude "*/tf_schema_generated.h"
+ --exclude "*/tf_schema_generated.h" \
+ --exclude "*/nnstreamer_layer.*"
+# nnstreamer layer is untestable here
# Visualize the report
genhtml -o result unittest.info -t "nntrainer %{version}-%{release} ${VCS}" --ignore-errors source -p ${RPM_BUILD_DIR}
'unittest_layers_rnn.cpp',
'unittest_layers_lstm.cpp',
'unittest_layers_gru.cpp',
- 'unittest_layers_preprocess.cpp',
+ 'unittest_layers_preprocess_flip.cpp',
'unittest_layers_split.cpp',
'unittest_layers_embedding.cpp',
'unittest_layers_concat.cpp',
- 'unittest_layers_tflite.cpp',
'unittest_layers_permute.cpp',
- 'unittest_layers_nnstreamer.cpp',
]
+if get_option('enable-tflite-backbone')
+ test_target += 'unittest_layers_tflite.cpp'
+endif
+
+if opencv_dep.found()
+ test_target += 'unittest_layers_preprocess_translate.cpp'
+endif
+
+if get_option('enable-nnstreamer-backbone')
+ if get_option('platform') != 'tizen'
+ # ml singleshot api cannot be tested inside tizen because of feature issue
+ test_target += 'unittest_layers_nnstreamer.cpp'
+ endif
+endif
+
exe = executable(
'unittest_layers', test_target,
dependencies: [
/**
* Copyright (C) 2021 Parichay Kapoor <pk.kapoor@samsung.com>
*
- * @file unittest_layers_fully_connected.cpp
- * @date 11 June 2021
- * @brief Preprocess Layer Test
+ * @file unittest_layers_preprocess_flip.cpp
+ * @date 11 June Flip
+ * @brief Preprocess flip Layer Test
* @see https://github.com/nnstreamer/nntrainer
* @author Parichay Kapoor <pk.kapoor@samsung.com>
* @bug No known bugs except for NYI items
#include <layers_common_tests.h>
#include <preprocess_flip_layer.h>
-#include <preprocess_translate_layer.h>
auto semantic_flip = LayerSemanticsParamType(
nntrainer::createLayer<nntrainer::PreprocessFlipLayer>,
nntrainer::PreprocessFlipLayer::type, {}, 0, false);
-auto semantic_translate = LayerSemanticsParamType(
- nntrainer::createLayer<nntrainer::PreprocessTranslateLayer>,
- nntrainer::PreprocessTranslateLayer::type, {}, 0, false);
-
INSTANTIATE_TEST_CASE_P(Preprocess, LayerSemantics,
- ::testing::Values(semantic_flip, semantic_translate));
+ ::testing::Values(semantic_flip));
--- /dev/null
+// SPDX-License-Identifier: Apache-2.0
+/**
+ * Copyright (C) 2021 Parichay Kapoor <pk.kapoor@samsung.com>
+ *
+ * @file unittest_layers_preprocess_translate.cpp
+ * @date 11 June 2021
+ * @brief Preprocess Translate Layer Test
+ * @see https://github.com/nnstreamer/nntrainer
+ * @author Parichay Kapoor <pk.kapoor@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+#include <tuple>
+
+#include <gtest/gtest.h>
+
+#include <layers_common_tests.h>
+#include <preprocess_translate_layer.h>
+
+auto semantic_translate = LayerSemanticsParamType(
+ nntrainer::createLayer<nntrainer::PreprocessTranslateLayer>,
+ nntrainer::PreprocessTranslateLayer::type, {"random_translate=0.1"}, 0,
+ false);
+
+INSTANTIATE_TEST_CASE_P(Preprocess, LayerSemantics,
+ ::testing::Values(semantic_translate));
#include <layers_common_tests.h>
#include <split_layer.h>
-auto semantic_split =
- LayerSemanticsParamType(nntrainer::createLayer<nntrainer::SplitLayer>,
- nntrainer::SplitLayer::type, {}, 0, false);
+auto semantic_split = LayerSemanticsParamType(
+ nntrainer::createLayer<nntrainer::SplitLayer>, nntrainer::SplitLayer::type,
+ {"split_dimension=3"}, 0, false);
INSTANTIATE_TEST_CASE_P(Split, LayerSemantics,
::testing::Values(semantic_split));