diff --git a/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.cpp b/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.cpp index ccd98c5c2aec1f..9045058f38d06b 100644 --- a/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.cpp +++ b/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.cpp @@ -12,6 +12,7 @@ #include "list.hpp" #include #include "caseless.hpp" +#include using namespace MKLDNNPlugin; using namespace InferenceEngine; @@ -290,6 +291,40 @@ bool MKLDNNExtractImagePatchesNode::isSupportedOperation(const std::shared_ptr& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) : MKLDNNNode(op, eng, cache) { std::string errorMessage; @@ -340,11 +375,30 @@ void MKLDNNExtractImagePatchesNode::prepareParams() { const auto& in_dims = getParentEdgeAt(0)->getMemory().getStaticDims(); const auto& out_dims = getChildEdgesAtPort(0)[0]->getMemory().getStaticDims(); const auto prcSize = getOriginalInputPrecisionAtPort(0).size(); - if (mayiuse(x64::sse41)) { - execPtr = std::make_shared(in_dims, out_dims, _ksizes, _strides, _rates, _auto_pad, prcSize); - } else { - execPtr = std::make_shared(in_dims, out_dims, _ksizes, _strides, _rates, _auto_pad, prcSize); - } + ExtractImagePatchesKey key = {in_dims, out_dims, _ksizes, _strides, _rates, _auto_pad, prcSize}; + const auto isJit = mayiuse(x64::sse41); + auto buildExecutor = [&isJit](const ExtractImagePatchesKey& key) -> executorPtr { + if (isJit) { + return std::make_shared(key.inDims, + key.outDims, + key.kSizes, + key.strides, + key.rates, + key.padType, + key.prcSize); + } else { + return std::make_shared(key.inDims, + key.outDims, + key.kSizes, + key.strides, + key.rates, + key.padType, + key.prcSize); + } + }; + auto cache = getRuntimeCache(); + auto result = cache->getOrCreate(key, buildExecutor); + execPtr = result.first; } void MKLDNNExtractImagePatchesNode::initSupportedPrimitiveDescriptors() { diff --git a/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.h b/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.h index d35d9f48d3b9c8..6a96fd48a30fc3 100644 --- a/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.h +++ b/src/plugins/intel_cpu/src/nodes/mkldnn_extract_image_patches_node.h @@ -52,14 +52,13 @@ class MKLDNNExtractImagePatchesNode : public MKLDNNNode { void prepareParams() override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; - -private: enum class ExtImgPatcherPadType { VALID, SAME_LOWER, SAME_UPPER }; +private: std::vector _ksizes; std::vector _strides; std::vector _rates; diff --git a/src/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp b/src/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp index 2c58b36392f79e..e8a76305fd2312 100755 --- a/src/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp +++ b/src/tests/functional/plugin/cpu/single_layer_tests/extract_image_patches.cpp @@ -79,13 +79,13 @@ const std::vector inputShapes = { // dynamic {-1, -1, -1, -1}, // static - {{2, 3, 13, 37}, {6, 4, 14, 14}, {8, 12, 15, 16}} + {{2, 3, 13, 37}, {6, 4, 14, 14}, {8, 12, 15, 16}, {2, 3, 13, 37}} }, InputShape{ // dynamic {{5, 15}, {6, 17}, {10, 15}, {13, 16}}, // static - {{5, 17, 10, 15}, {15, 10, 12, 13}, {10, 10, 15, 16}} + {{5, 17, 10, 15}, {15, 10, 12, 13}, {10, 10, 15, 16}, {5, 17, 10, 15}} }, };