From 50e003cdede17fd0b1835e704fcecc9ee4637814 Mon Sep 17 00:00:00 2001 From: Alexandra Sidorova Date: Mon, 10 Aug 2020 13:59:17 +0300 Subject: [PATCH] [CPU] Added Mish activation (#1555) --- .../src/mkldnn_plugin/mkldnn_graph_optimizer.cpp | 12 +++++++----- inference-engine/src/mkldnn_plugin/mkldnn_node.cpp | 1 + .../mkldnn_plugin/nodes/mkldnn_activation_node.cpp | 5 +++++ .../cpu/shared_tests_instances/skip_tests_config.cpp | 2 -- inference-engine/thirdparty/mkl-dnn | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp index f888694cd03e1c..e2d10296bbac68 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp @@ -704,7 +704,8 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndActivation(MKLDNNGraph &graph) { return activationNode && (activationNode->getAlgorithm() == eltwise_relu || (conv->getCnnLayer()->precision == Precision::FP32 && - isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp, eltwise_swish}))); + isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp, + eltwise_swish, eltwise_mish}))); }; for (int i = 0; i < graphNodes.size(); i++) { @@ -1187,7 +1188,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndSimpleOperation(MKLDNNGraph &graph) THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName(); return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu, - eltwise_clamp, eltwise_swish}); + eltwise_clamp, eltwise_swish, eltwise_mish}); } return false; @@ -1431,7 +1432,8 @@ void MKLDNNGraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(MKLDNNG return activationNode && (activationNode->getAlgorithm() == eltwise_relu || (conv->getCnnLayer()->precision == Precision::FP32 && - isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp, eltwise_swish}))); + isOneOf(activationNode->getAlgorithm(), {eltwise_elu, eltwise_logistic, eltwise_bounded_relu, eltwise_clamp, + eltwise_swish, eltwise_mish}))); #else return false; #endif @@ -1781,7 +1783,7 @@ void MKLDNNGraphOptimizer::FuseNormalizeAndSimpleOperation(MKLDNNGraph &graph) { if (activationNode == nullptr) THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName(); return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_gelu, eltwise_elu, eltwise_logistic, - eltwise_bounded_relu, eltwise_clamp, eltwise_tanh, eltwise_swish, eltwise_linear, eltwise_abs, + eltwise_bounded_relu, eltwise_clamp, eltwise_tanh, eltwise_swish, eltwise_mish, eltwise_linear, eltwise_abs, eltwise_square, eltwise_sqrt}); } return false; @@ -1893,7 +1895,7 @@ void MKLDNNGraphOptimizer::FuseEltwiseAndSimple(MKLDNNGraph &graph) { if (activationNode == nullptr) THROW_IE_EXCEPTION << "Cannot get activation layer " << node->getName(); return isOneOf(activationNode->getAlgorithm(), {eltwise_relu, eltwise_elu, eltwise_logistic, eltwise_bounded_relu, - eltwise_clamp, eltwise_swish}); + eltwise_clamp, eltwise_swish, eltwise_mish}); } return false; diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp index e225b7e255bfed..045b5e17d69a03 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp @@ -75,6 +75,7 @@ static const InferenceEngine::details::caseless_unordered_map { "Activation", Activation }, { "Clamp", Activation }, { "Swish", Activation }, + { "Mish", Activation }, { "ScaleShift", Depthwise }, { "PReLU", Depthwise }, { "Norm", Lrn }, diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_activation_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_activation_node.cpp index 0db732fa455ba2..9b214d096144a7 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_activation_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_activation_node.cpp @@ -96,6 +96,11 @@ caseless_map disabledTestPatterns() { R"(.*ActivationLayerTest.*Ceiling.*)", // TODO: Issue: 32032 R"(.*ActivationParamLayerTest.*)", - // TODO: Issue: 32959 - R"(.*ActivationLayerTest.*Mish.*)", // TODO: Issue: 30999 (Implement Interpolate reference in NGraph) R"(.*InterpolateLayerTest.*)" }; diff --git a/inference-engine/thirdparty/mkl-dnn b/inference-engine/thirdparty/mkl-dnn index 36f650aac835b5..4f511de56e21b4 160000 --- a/inference-engine/thirdparty/mkl-dnn +++ b/inference-engine/thirdparty/mkl-dnn @@ -1 +1 @@ -Subproject commit 36f650aac835b5ef8ab2459eda337ed881a1d3c4 +Subproject commit 4f511de56e21b417f7c49c3f50cf7217350412ab