[CPU] Added operation HSigmoid-5 (#2005)
This commit is contained in:
parent
5007cba70a
commit
de686fce39
@ -716,7 +716,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndActivation(MKLDNNGraph &graph) {
|
|||||||
(activationNode->getAlgorithm() == eltwise_relu ||
|
(activationNode->getAlgorithm() == eltwise_relu ||
|
||||||
(conv->getCnnLayer()->precision == Precision::FP32 &&
|
(conv->getCnnLayer()->precision == Precision::FP32 &&
|
||||||
isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp,
|
isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp,
|
||||||
eltwise_swish, eltwise_hswish, eltwise_mish})));
|
eltwise_swish, eltwise_hswish, eltwise_mish, eltwise_hsigmoid})));
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < graphNodes.size(); i++) {
|
for (int i = 0; i < graphNodes.size(); i++) {
|
||||||
@ -854,7 +854,9 @@ void MKLDNNGraphOptimizer::FuseFullyConnectedAndSimpleOperation(MKLDNNGraph &gra
|
|||||||
if (activationNode == nullptr)
|
if (activationNode == nullptr)
|
||||||
THROW_IE_EXCEPTION << "Cannot get activation layer " << childNode->getName();
|
THROW_IE_EXCEPTION << "Cannot get activation layer " << childNode->getName();
|
||||||
|
|
||||||
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp});
|
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic,
|
||||||
|
eltwise_bounded_relu, eltwise_clamp, eltwise_swish, eltwise_hswish,
|
||||||
|
eltwise_mish, eltwise_hsigmoid});
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1199,7 +1201,8 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndSimpleOperation(MKLDNNGraph &graph)
|
|||||||
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
||||||
|
|
||||||
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu,
|
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu,
|
||||||
eltwise_clamp, eltwise_swish, eltwise_hswish, eltwise_mish});
|
eltwise_clamp, eltwise_swish, eltwise_hswish, eltwise_mish,
|
||||||
|
eltwise_hsigmoid});
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1444,7 +1447,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(MKLDNNG
|
|||||||
(activationNode->getAlgorithm() == eltwise_relu ||
|
(activationNode->getAlgorithm() == eltwise_relu ||
|
||||||
(conv->getCnnLayer()->precision == Precision::FP32 &&
|
(conv->getCnnLayer()->precision == Precision::FP32 &&
|
||||||
isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp,
|
isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp,
|
||||||
eltwise_swish, eltwise_hswish, eltwise_mish})));
|
eltwise_swish, eltwise_hswish, eltwise_mish, eltwise_hsigmoid})));
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@ -1862,8 +1865,8 @@ void MKLDNNGraphOptimizer::FuseNormalizeAndSimpleOperation(MKLDNNGraph &graph) {
|
|||||||
if (activationNode == nullptr)
|
if (activationNode == nullptr)
|
||||||
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
||||||
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic,
|
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic,
|
||||||
eltwise_bounded_relu, eltwise_clamp, eltwise_tanh, eltwise_swish, eltwise_hswish, eltwise_mish, eltwise_linear,
|
eltwise_bounded_relu, eltwise_clamp, eltwise_tanh, eltwise_swish, eltwise_hswish, eltwise_mish,
|
||||||
eltwise_abs, eltwise_square, eltwise_sqrt});
|
eltwise_hsigmoid, eltwise_linear, eltwise_abs, eltwise_square, eltwise_sqrt});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -1974,7 +1977,8 @@ void MKLDNNGraphOptimizer::FuseEltwiseAndSimple(MKLDNNGraph &graph) {
|
|||||||
if (activationNode == nullptr)
|
if (activationNode == nullptr)
|
||||||
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
||||||
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu,
|
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu,
|
||||||
eltwise_clamp, eltwise_swish, eltwise_hswish, eltwise_mish});
|
eltwise_clamp, eltwise_swish, eltwise_hswish, eltwise_mish,
|
||||||
|
eltwise_hsigmoid});
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,6 +77,7 @@ static const InferenceEngine::details::caseless_unordered_map<std::string, Type>
|
|||||||
{ "Swish", Activation },
|
{ "Swish", Activation },
|
||||||
{ "HSwish", Activation },
|
{ "HSwish", Activation },
|
||||||
{ "Mish", Activation },
|
{ "Mish", Activation },
|
||||||
|
{ "HSigmoid", Activation },
|
||||||
{ "ScaleShift", Depthwise },
|
{ "ScaleShift", Depthwise },
|
||||||
{ "PReLU", Depthwise },
|
{ "PReLU", Depthwise },
|
||||||
{ "Norm", Lrn },
|
{ "Norm", Lrn },
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <transformations/op_conversions/convert_space_to_depth.hpp>
|
#include <transformations/op_conversions/convert_space_to_depth.hpp>
|
||||||
#include <transformations/op_conversions/convert_gelu.hpp>
|
#include <transformations/op_conversions/convert_gelu.hpp>
|
||||||
#include <transformations/op_conversions/hswish_decomposition.hpp>
|
#include <transformations/op_conversions/hswish_decomposition.hpp>
|
||||||
|
#include <transformations/op_conversions/hsigmoid_decomposition.hpp>
|
||||||
#include <transformations/op_conversions/reduce_l1_decomposition.hpp>
|
#include <transformations/op_conversions/reduce_l1_decomposition.hpp>
|
||||||
#include <transformations/op_conversions/reduce_l2_decomposition.hpp>
|
#include <transformations/op_conversions/reduce_l2_decomposition.hpp>
|
||||||
#include <transformations/op_conversions/convert_pad_to_group_conv.hpp>
|
#include <transformations/op_conversions/convert_pad_to_group_conv.hpp>
|
||||||
@ -143,6 +144,7 @@ static void Transformation(ICNNNetwork::Ptr& clonedNetwork, const Config& conf)
|
|||||||
pass_config->disable<ngraph::pass::ReduceL1Decomposition>();
|
pass_config->disable<ngraph::pass::ReduceL1Decomposition>();
|
||||||
pass_config->disable<ngraph::pass::ReduceL2Decomposition>();
|
pass_config->disable<ngraph::pass::ReduceL2Decomposition>();
|
||||||
pass_config->disable<ngraph::pass::SoftPlusDecomposition>();
|
pass_config->disable<ngraph::pass::SoftPlusDecomposition>();
|
||||||
|
pass_config->disable<ngraph::pass::HSigmoidDecomposition>();
|
||||||
|
|
||||||
pass_config->enable<ngraph::pass::ConvertPadToGroupConvolution>();
|
pass_config->enable<ngraph::pass::ConvertPadToGroupConvolution>();
|
||||||
|
|
||||||
|
@ -106,6 +106,11 @@ caseless_map<std::string, std::function<void(GenericLayer*, mkldnn::algorithm&,
|
|||||||
beta = 0.0f;
|
beta = 0.0f;
|
||||||
algorithm = eltwise_mish;
|
algorithm = eltwise_mish;
|
||||||
}},
|
}},
|
||||||
|
{"hsigmoid", [](GenericLayer* activationLayer, mkldnn::algorithm& algorithm, float& alpha, float& beta) {
|
||||||
|
alpha = 0.0f;
|
||||||
|
beta = 0.0f;
|
||||||
|
algorithm = eltwise_hsigmoid;
|
||||||
|
}},
|
||||||
};
|
};
|
||||||
|
|
||||||
MKLDNNActivationNode::MKLDNNActivationNode(const InferenceEngine::CNNLayerPtr& layer, const mkldnn::engine& eng,
|
MKLDNNActivationNode::MKLDNNActivationNode(const InferenceEngine::CNNLayerPtr& layer, const mkldnn::engine& eng,
|
||||||
|
@ -2183,8 +2183,8 @@ bool MKLDNNInterpolateNode::canFuse(const MKLDNNNodePtr& node) const {
|
|||||||
if (activationNode == nullptr)
|
if (activationNode == nullptr)
|
||||||
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName();
|
||||||
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic,
|
return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic,
|
||||||
eltwise_bounded_relu, eltwise_clamp, eltwise_tanh, eltwise_swish, eltwise_hswish, eltwise_mish, eltwise_linear,
|
eltwise_bounded_relu, eltwise_clamp, eltwise_tanh, eltwise_swish, eltwise_hswish, eltwise_mish, eltwise_hsigmoid,
|
||||||
eltwise_abs, eltwise_square, eltwise_sqrt});
|
eltwise_linear, eltwise_abs, eltwise_square, eltwise_sqrt});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,8 @@ const std::map<ActivationTypes, std::vector<std::vector<float>>> activationTypes
|
|||||||
{Ceiling, {}},
|
{Ceiling, {}},
|
||||||
{Mish, {}},
|
{Mish, {}},
|
||||||
{HSwish, {}},
|
{HSwish, {}},
|
||||||
{SoftPlus, {}}
|
{SoftPlus, {}},
|
||||||
|
{HSigmoid, {}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::map<ActivationTypes, std::vector<std::vector<float>>> activationParamTypes = {
|
const std::map<ActivationTypes, std::vector<std::vector<float>>> activationParamTypes = {
|
||||||
|
2
inference-engine/thirdparty/mkl-dnn
vendored
2
inference-engine/thirdparty/mkl-dnn
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 6547f0b6aac2725bd4e36197e19fb1a6f2ee2f51
|
Subproject commit 4b239023043318899e1c0a3b79158a68b7efe6e4
|
Loading…
Reference in New Issue
Block a user