[IE][VPU]: Added Mish layer (#1158)
* Add Mish stage in GraphTransformer * Add Mish per-layer tests
This commit is contained in:
parent
07bedc5d6f
commit
8a6bd1dba3
@ -154,6 +154,7 @@ public:
|
||||
void parseOutShapeOfReshape(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
|
||||
void parseBroadcast(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
|
||||
void parseStaticShapeNMS(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
|
||||
void parseMish(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
|
||||
void parseGelu(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const;
|
||||
|
||||
//
|
||||
|
@ -167,6 +167,7 @@ VPU_DECLARE_ENUM(StageType,
|
||||
Concat = 128,
|
||||
Broadcast = 129,
|
||||
StaticShapeNMS = 130,
|
||||
Mish = 131,
|
||||
Gelu = 132,
|
||||
StridedSlice = 133,
|
||||
)
|
||||
|
@ -118,6 +118,7 @@ FrontEnd::FrontEnd(StageBuilder::Ptr stageBuilder)
|
||||
{"StaticShapeBroadcast", LAYER_PARSER(parseBroadcast)},
|
||||
{"StaticShapeNonMaxSuppression", LAYER_PARSER(parseStaticShapeNMS)},
|
||||
{"StaticShapeReshape", LAYER_PARSER(parseReshape)},
|
||||
{"Mish", LAYER_PARSER(parseMish)},
|
||||
{"Gelu", LAYER_PARSER(parseGelu)},
|
||||
}} {}
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <vpu/frontend/frontend.hpp>
|
||||
#include <vpu/stages/post_op_stage.hpp>
|
||||
|
||||
namespace vpu {
|
||||
|
||||
namespace {
|
||||
|
||||
class MishStage final : public PostOpStage {
|
||||
public:
|
||||
using PostOpStage::PostOpStage;
|
||||
|
||||
private:
|
||||
StagePtr cloneImpl() const override {
|
||||
return std::make_shared<MishStage>(*this);
|
||||
}
|
||||
|
||||
void serializeParamsImpl(BlobSerializer&) const override {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void FrontEnd::parseMish(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs) const {
|
||||
VPU_THROW_UNLESS(inputs.size() == 1,
|
||||
"Mish stage with name %s must have only 1 input, "
|
||||
"actually provided %d", layer->name, inputs.size());
|
||||
VPU_THROW_UNLESS(outputs.size() == 1,
|
||||
"Mish stage with name %s must have only 1 output, "
|
||||
"actually provided %d", layer->name, outputs.size());
|
||||
|
||||
model->addNewStage<MishStage>(layer->name, StageType::Mish, layer, inputs, outputs);
|
||||
}
|
||||
|
||||
} // namespace vpu
|
@ -21,7 +21,8 @@ const std::vector<ActivationTypes> activationTypes = {
|
||||
Relu,
|
||||
Exp,
|
||||
Log,
|
||||
Gelu
|
||||
Gelu,
|
||||
Mish
|
||||
};
|
||||
|
||||
std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> basic = {
|
||||
|
Loading…
Reference in New Issue
Block a user