[IE][VPU]: support new operation CEILING (#3004)
authorAndrey Sokolov <andrey.sokolov@intel.com>
Tue, 10 Nov 2020 16:28:53 +0000 (19:28 +0300)
committerGitHub <noreply@github.com>
Tue, 10 Nov 2020 16:28:53 +0000 (19:28 +0300)
Add new Operation "Ceiling" for VPU Myriad
task: -42885

inference-engine/cmake/vpu_dependencies.cmake
inference-engine/src/vpu/graph_transformer/include/vpu/frontend/frontend.hpp
inference-engine/src/vpu/graph_transformer/include/vpu/model/stage.hpp
inference-engine/src/vpu/graph_transformer/src/frontend/frontend.cpp
inference-engine/src/vpu/graph_transformer/src/stages/ceiling.cpp [new file with mode: 0644]
inference-engine/tests/functional/plugin/myriad/shared_tests_instances/single_layer_tests/activation.cpp
inference-engine/tests/functional/plugin/shared/src/single_layer_tests/activation.cpp

index e8cb7a0..c03ad6e 100644 (file)
@@ -19,7 +19,7 @@ set(VPU_SUPPORTED_FIRMWARES usb-ma2x8x pcie-ma248x)
 # Default packages
 #
 
-set(FIRMWARE_PACKAGE_VERSION 1452)
+set(FIRMWARE_PACKAGE_VERSION 1460)
 set(VPU_CLC_MA2X8X_VERSION "movi-cltools-20.09.2")
 
 #
index 0b85b29..c825329 100644 (file)
@@ -159,6 +159,7 @@ public:
     void parseLogicalNot(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
     void parseGatherND(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
     void parseHSwish(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
+    void parseCeiling(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
 
     //
     // Special layers
index 96c4922..dd99362 100644 (file)
@@ -132,6 +132,7 @@ FrontEnd::FrontEnd(StageBuilder::Ptr stageBuilder, const ie::ICore* core)
         {"Activation",                                         LAYER_PARSER(parseActivation)},
         {"GatherND",                                           LAYER_PARSER(parseGatherND)},
         {"HSwish",                                             LAYER_PARSER(parseHSwish)},
+        {"Ceiling",                                            LAYER_PARSER(parseCeiling)},
     }} {
         VPU_THROW_UNLESS(_core != nullptr, "Argument core is null");
     }
diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/ceiling.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/ceiling.cpp
new file mode 100644 (file)
index 0000000..56ff085
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2020 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <vpu/frontend/frontend.hpp>
+#include <vpu/stages/post_op_stage.hpp>
+
+#include <vector>
+#include <memory>
+#include <set>
+
+namespace vpu {
+
+namespace {
+
+class CeilingStage final : public PostOpStage {
+public:
+    using PostOpStage::PostOpStage;
+
+private:
+    StagePtr cloneImpl() const override {
+        return std::make_shared<CeilingStage>(*this);
+    }
+
+    void serializeParamsImpl(BlobSerializer&) const override {
+    }
+};
+
+}  // namespace
+
+void FrontEnd::parseCeiling(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const {
+    VPU_THROW_UNLESS(inputs.size() == 1,
+                     "Ceiling stage with name {} must have only 1 input, actually provided {} inputs",
+                     layer->name, inputs.size());
+
+    VPU_THROW_UNLESS(outputs.size() == 1,
+                     "Ceiling stage with name {} must have only 1 output, actually provided {} outputs",
+                     layer->name, outputs.size());
+
+    model->addNewStage<CeilingStage>(layer->name, StageType::Ceiling, layer, inputs, outputs);
+}
+
+}  // namespace vpu
index 8128f3a..aa5592f 100644 (file)
@@ -26,6 +26,7 @@ const std::map<ActivationTypes, std::vector<std::vector<float>>> activationTypes
         {SoftPlus, {}},
         {Swish,    {{0.05f}, {0.8f}, {1.0f}, {15.0f}}},
         {HSwish,   {}},
+        {Ceiling,  {}},
 };
 
 std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> basic = {
index 467d8dc..67f1827 100644 (file)
@@ -84,6 +84,11 @@ InferenceEngine::Blob::Ptr ActivationLayerTest::GenerateInput(const InferenceEng
             data_range = 2;
             break;
         }
+        case ngraph::helpers::ActivationTypes::Ceiling: {
+            data_start_from = -1000;
+            data_range = 2000;
+            break;
+        }
         default: {
             data_start_from = -10;
             data_range = 20;