diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp index 7ea97eca345..1261df4b559 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp @@ -457,7 +457,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndZeroPoints(MKLDNNGraph &graph) { if (auto convNode = std::dynamic_pointer_cast(node)) { auto rank = convNode->getInputShapeAtPort(0).getRank(); // int8 depthwise convolution does not support fusing zero points in 3D case - if (implication(convNode->isDepthWise(), rank == 4)) { + if (implication(convNode->isDepthWise(), rank < 5)) { retVal = true; } } @@ -577,7 +577,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndZeroPoints(MKLDNNGraph &graph) { ptrdiff_t OC = weightsConstantDims[0 + groupOffset]; ptrdiff_t IC = weightsConstantDims[1 + groupOffset]; ptrdiff_t KD = weightsConstantDims.size() == (5 + groupOffset) ? weightsConstantDims[weightsConstantDims.size() - 3] : 1; - ptrdiff_t KH = weightsConstantDims[weightsConstantDims.size() - 2]; + ptrdiff_t KH = node->getInputShapeAtPort(0).getRank() > (3 + groupOffset) ? weightsConstantDims[weightsConstantDims.size() - 2] : 1; ptrdiff_t KW = weightsConstantDims[weightsConstantDims.size() - 1]; for (size_t g = 0; g < G; g++) { diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp index 0fda2ab04fb..cda4c052816 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_node.cpp @@ -491,7 +491,8 @@ std::vector MKLDNNNode::getAvailableFormatsForDims(const Sha else if (dims.getRank() == 2) return {memory::format_tag::nc}; else if (dims.getRank() == 3) - return {memory::format_tag::tnc, memory::format_tag::ntc}; + return {memory::format_tag::tnc, memory::format_tag::ntc, + memory::format_tag::ncw, memory::format_tag::nCw8c, memory::format_tag::nCw16c }; else if (dims.getRank() == 4) return {memory::format_tag::nchw, memory::format_tag::nChw8c, memory::format_tag::nChw16c}; else if (dims.getRank() == 5) diff --git a/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp b/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp index 3118d3457e7..ff901fbafc0 100644 --- a/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp +++ b/inference-engine/src/mkldnn_plugin/ngraph_transformations/convert_to_cpu_specific_opset.hpp @@ -6,7 +6,6 @@ #include "fc_bias_fusion.hpp" #include "ngraph/op/fake_quantize.hpp" #include "ngraph/pass/manager.hpp" -#include "reshape_1d_ops.hpp" #include "reshape_fc_fusion.hpp" #include "reshape_fully_connected.hpp" #include "align_matmul_input_ranks.hpp" @@ -26,10 +25,6 @@ namespace MKLDNNPlugin { inline void ConvertToCPUSpecificOpset(std::shared_ptr &nGraphFunc) { ngraph::pass::Manager manager; manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); manager.register_pass(); manager.register_pass(); manager.register_pass(); diff --git a/inference-engine/src/mkldnn_plugin/ngraph_transformations/reshape_1d_ops.cpp b/inference-engine/src/mkldnn_plugin/ngraph_transformations/reshape_1d_ops.cpp deleted file mode 100644 index 85321404785..00000000000 --- a/inference-engine/src/mkldnn_plugin/ngraph_transformations/reshape_1d_ops.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "reshape_1d_ops.hpp" - -#include -#include -#include - -#include -#include -#include -#include - -#include "transformations/utils/utils.hpp" - -namespace { -template -std::shared_ptr convert(const ngraph::Output & data, std::shared_ptr node, ngraph::NodeVector &new_ops) { - auto new_strides = node->get_strides(); - auto new_dilations = node->get_dilations(); - auto new_pads_begin = node->get_pads_begin(); - auto new_pad_end = node->get_pads_end(); - - new_strides.insert(new_strides.begin(), 1); - new_dilations.insert(new_dilations.begin(), 1); - new_pads_begin.insert(new_pads_begin.begin(), 0); - new_pad_end.insert(new_pad_end.begin(), 0); - - const size_t weights_rank = node->get_input_partial_shape(1).size(); - const auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { weights_rank - 1 }); - const auto weights = ngraph::op::util::make_try_fold(node->input_value(1), unsqueeze_const); - new_ops.push_back(weights); - - if (std::dynamic_pointer_cast(node)) { - return std::make_shared>(std::vector{ngraph::element::f32, ngraph::element::f32}, - std::vector{ngraph::element::f32}, - ngraph::op::TemporaryReplaceOutputType(data, ngraph::element::f32).get(), - ngraph::op::TemporaryReplaceOutputType(weights, ngraph::element::f32).get(), - new_strides, - new_pads_begin, - new_pad_end, - new_dilations, - node->get_auto_pad()); - } else { - return std::make_shared(data, - weights, - new_strides, - new_pads_begin, - new_pad_end, - new_dilations, - node->get_auto_pad()); - } -} - -template <> -std::shared_ptr convert(const ngraph::Output & data, std::shared_ptr node, ngraph::NodeVector & new_ops) { - auto new_strides = node->get_strides(); - auto new_pads_begin = node->get_pads_begin(); - auto new_pad_end = node->get_pads_end(); - auto new_kernel = node->get_kernel(); - - new_strides.insert(new_strides.begin(), 1); - new_pads_begin.insert(new_pads_begin.begin(), 0); - new_pad_end.insert(new_pad_end.begin(), 0); - new_kernel.insert(new_kernel.begin(), 1); - - return std::make_shared(data, - new_strides, - new_pads_begin, - new_pad_end, - new_kernel, - node->get_rounding_type(), - node->get_auto_pad()); -} - -template <> -std::shared_ptr convert(const ngraph::Output & data, std::shared_ptr node, ngraph::NodeVector & new_ops) { - // Update Pooling attributes with additional dimension - auto new_strides = node->get_strides(); - auto new_pads_begin = node->get_pads_begin(); - auto new_pad_end = node->get_pads_end(); - auto new_kernel = node->get_kernel(); - - new_strides.insert(new_strides.begin(), 1); - new_pads_begin.insert(new_pads_begin.begin(), 0); - new_pad_end.insert(new_pad_end.begin(), 0); - new_kernel.insert(new_kernel.begin(), 1); - - return std::make_shared(data, - new_strides, - new_pads_begin, - new_pad_end, - new_kernel, - node->get_exclude_pad(), - node->get_rounding_type(), - node->get_auto_pad()); -} - -ngraph::matcher_pass_callback get_callback() { - return [](ngraph::pattern::Matcher& m) { - auto node = m.get_match_root(); - const auto input_rank = node->get_input_partial_shape(0).size(); - if (input_rank != 3) { - return false; - } - - ngraph::NodeVector new_ops; - - // Update pshape from [N, C, W] to [N, C, 1, W] - const auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { input_rank - 1 }); - ngraph::Output last = std::make_shared(node->input_value(0), unsqueeze_const); - last.get_node_shared_ptr()->set_friendly_name(node->get_friendly_name() + "/reshape_begin"); - new_ops.push_back(last.get_node_shared_ptr()); - - if (auto conv = std::dynamic_pointer_cast(node)) { - last = convert(last, conv, new_ops); - } else if (auto group_conv = std::dynamic_pointer_cast(node)) { - last = convert(last, group_conv, new_ops); - } else if (auto max_pool = std::dynamic_pointer_cast(node)) { - last = convert(last, max_pool, new_ops); - } else if (auto avg_pool = std::dynamic_pointer_cast(node)) { - last = convert(last, avg_pool, new_ops); - } else { - throw ngraph::ngraph_error("Reshape1DOps: op type is not supported"); - } - - last.get_node_shared_ptr()->set_friendly_name(node->get_friendly_name() + "/new"); - new_ops.push_back(last.get_node_shared_ptr()); - - // if convolution is followed by add we need to replace add before output reshape to fuse conv+bias on plug-in side - std::shared_ptr add_to_replace = nullptr; - std::shared_ptr reshaped_add = nullptr; - ngraph::NodeVector bias_ops; - if (std::dynamic_pointer_cast(node) || std::dynamic_pointer_cast(node)) { - auto out_pshape = node->get_output_partial_shape(0); - const auto dst_nodes = node->get_output_target_inputs(0); - - // we can also reshape biases if possible - if (dst_nodes.size() == 1 && out_pshape.rank().is_static() && out_pshape.rank().get_length() > 2 && out_pshape[1].is_static()) { - auto channel = node->get_output_partial_shape(0)[1]; - ngraph::Shape expected_shape = ngraph::Shape(input_rank, 1); - expected_shape[1] = channel.get_length(); - - add_to_replace = dst_nodes.begin()->get_node()->shared_from_this(); - if (std::dynamic_pointer_cast(add_to_replace) && - std::dynamic_pointer_cast(add_to_replace->get_input_node_shared_ptr(1)) && - add_to_replace->get_input_shape(1) == expected_shape) { - ngraph::Shape new_shape(add_to_replace->get_input_shape(1)); - new_shape.push_back(1); - auto new_shape_const = ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{ new_shape.size() }, new_shape); - - auto new_bias = ngraph::op::util::make_try_fold(add_to_replace->input_value(1), new_shape_const, true); - reshaped_add = std::make_shared(last, new_bias); - reshaped_add->set_friendly_name(add_to_replace->get_friendly_name() + "/new"); - bias_ops.push_back(new_bias); - bias_ops.push_back(reshaped_add); - } - } - } - - if (reshaped_add != nullptr) { - ngraph::replace_node(node, last.get_node_shared_ptr()); - ngraph::copy_runtime_info(node, new_ops); - last = reshaped_add; - node = add_to_replace; - new_ops = bias_ops; - } - - // Update pshape from [N, C, 1, W] to [N, C, W] - const auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { input_rank - 1 }); - last = std::make_shared(last, squeeze_const); - last.get_node_shared_ptr()->set_friendly_name(node->get_friendly_name()); - ngraph::replace_node(node, last.get_node_shared_ptr()); - ngraph::copy_runtime_info(node, new_ops); - return true; - }; -} -} // namespace - -NGRAPH_RTTI_DEFINITION(MKLDNNPlugin::Reshape1DConvolution, "Reshape1DConvolution", 0); - -MKLDNNPlugin::Reshape1DConvolution::Reshape1DConvolution() { - auto activations = ngraph::pattern::any_input(ngraph::pattern::has_static_rank()); - auto weights = ngraph::pattern::any_input(ngraph::pattern::has_static_rank()); - auto conv = ngraph::pattern::wrap_type({ activations, weights }); - auto m = std::make_shared(conv, "Reshape1DConvolution"); - this->register_matcher(m, get_callback()); -} - -NGRAPH_RTTI_DEFINITION(MKLDNNPlugin::Reshape1DGroupConvolution, "Reshape1DGroupConvolution", 0); - -MKLDNNPlugin::Reshape1DGroupConvolution::Reshape1DGroupConvolution() { - auto activations = ngraph::pattern::any_input(ngraph::pattern::has_static_rank()); - auto weights = ngraph::pattern::any_input(ngraph::pattern::has_static_rank()); - auto group_conv = ngraph::pattern::wrap_type({ activations, weights }); - auto m = std::make_shared(group_conv, "Reshape1DGroupConvolution"); - this->register_matcher(m, get_callback()); -} - -NGRAPH_RTTI_DEFINITION(MKLDNNPlugin::Reshape1DAvgPool, "Reshape1DAvgPool", 0); - -MKLDNNPlugin::Reshape1DAvgPool::Reshape1DAvgPool() { - auto input = ngraph::pattern::any_input(ngraph::pattern::has_static_rank()); - auto pool = ngraph::pattern::wrap_type({ input }); - auto m = std::make_shared(pool, "Reshape1DAvgPool"); - this->register_matcher(m, get_callback()); -} - -NGRAPH_RTTI_DEFINITION(MKLDNNPlugin::Reshape1DMaxPool, "Reshape1DMaxPool", 0); - -MKLDNNPlugin::Reshape1DMaxPool::Reshape1DMaxPool() { - auto input = ngraph::pattern::any_input(ngraph::pattern::has_static_rank()); - auto pool = ngraph::pattern::wrap_type({ input }); - auto m = std::make_shared(pool, "Reshape1DMaxPool"); - this->register_matcher(m, get_callback()); -} diff --git a/inference-engine/src/mkldnn_plugin/ngraph_transformations/reshape_1d_ops.hpp b/inference-engine/src/mkldnn_plugin/ngraph_transformations/reshape_1d_ops.hpp deleted file mode 100644 index 04e734f7638..00000000000 --- a/inference-engine/src/mkldnn_plugin/ngraph_transformations/reshape_1d_ops.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -namespace MKLDNNPlugin { - -class Reshape1DConvolution: public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - Reshape1DConvolution(); -}; - -class Reshape1DGroupConvolution: public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - Reshape1DGroupConvolution(); -}; - -class Reshape1DAvgPool: public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - Reshape1DAvgPool(); -}; - -class Reshape1DMaxPool: public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - Reshape1DMaxPool(); -}; - -} // namespace MKLDNNPlugin \ No newline at end of file diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_conv_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_conv_node.cpp index c9d395f95ce..6132525193e 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_conv_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_conv_node.cpp @@ -33,7 +33,7 @@ bool MKLDNNConvolutionNode::isSupportedOperation(const std::shared_ptrget_input_partial_shape(0).rank().get_length(); - if ((ndims < 4) || (ndims > 5)) { + if ((ndims < 3) || (ndims > 5)) { errorMessage = "Doesn't support 'data' input with rank: " + std::to_string(ndims); return false; } @@ -254,10 +254,10 @@ void MKLDNNConvolutionNode::getSupportedDescriptors() { outputDataType = memory::data_type::f32; if (eltwisePrecision == Precision::BF16) eltwisePrecision = Precision::FP32; - in_candidate = std::make_shared(getInputShapeAtPort(0), - inputDataType, ndims == 5 ? memory::format_tag::ndhwc : memory::format_tag::nhwc); - out_candidate = std::make_shared(getOutputShapeAtPort(0), - outputDataType, ndims == 5 ? memory::format_tag::ndhwc : memory::format_tag::nhwc); + in_candidate = std::make_shared(getInputShapeAtPort(0), inputDataType, + ndims == 3 ? memory::format_tag::nwc : (ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc)); + out_candidate = std::make_shared(getOutputShapeAtPort(0), outputDataType, + ndims == 3 ? memory::format_tag::nwc : (ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc)); createDescriptor({ in_candidate }, { out_candidate }); } else { inputDataType = (getOriginalInputPrecisionAtPort(0) == Precision::BF16 @@ -289,11 +289,11 @@ void MKLDNNConvolutionNode::getSupportedDescriptors() { eltwisePrecision = Precision::FP32; } - if (one_of(ndims, 4, 5)) { - memory::format_tag ncsp = ndims == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw; - memory::format_tag nspc = ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc; - memory::format_tag nCsp16c = ndims == 4 ? memory::format_tag::nChw16c : memory::format_tag::nCdhw16c; - memory::format_tag nCsp8c = ndims == 4 ? memory::format_tag::nChw8c : memory::format_tag::nCdhw8c; + if (one_of(ndims, 3, 4, 5)) { + memory::format_tag nspc = ndims == 3 ? memory::format_tag::nwc : (ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc); + memory::format_tag ncsp = ndims == 3 ? memory::format_tag::ncw : (ndims == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw); + memory::format_tag nCsp8c = ndims == 3 ? memory::format_tag::nCw8c : (ndims == 4 ? memory::format_tag::nChw8c : memory::format_tag::nCdhw8c); + memory::format_tag nCsp16c = ndims == 3 ? memory::format_tag::nCw16c : (ndims == 4 ? memory::format_tag::nChw16c : memory::format_tag::nCdhw16c); auto inputShape = getInputShapeAtPort(0); auto outputShape = getOutputShapeAtPort(0); @@ -830,7 +830,7 @@ bool MKLDNNConvolutionNode::isNspcAvailable() const { if (isDepthWise()) { // 1d equivalent cases are painfully slow - if (1 == inpDims[inpDims.size() - 2]) { + if (inpDims.size() == 3 || 1 == inpDims[inpDims.size() - 2]) { return false; } } else { diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp index 6812a2737b7..c32932b7d62 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp @@ -1238,18 +1238,18 @@ void MKLDNNEltwiseNode::initSupportedPrimitiveDescriptors() { return {config, impl_type}; }; - bool isChannelsFirstApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1, 2, 4, 5); + bool isChannelsFirstApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1, 2, 3, 4, 5); for (size_t i = 0; i < getParentEdges().size(); i++) { - isChannelsFirstApplicable = isChannelsFirstApplicable && one_of(getInputShapeAtPort(i).getRank(), 1, 2, 4, 5); + isChannelsFirstApplicable = isChannelsFirstApplicable && one_of(getInputShapeAtPort(i).getRank(), 1, 2, 3, 4, 5); isChannelsFirstApplicable = isChannelsFirstApplicable && implication(getInputShapeAtPort(i).getRank() != 1, getOutputShapeAtPort(0).getRank() == getInputShapeAtPort(i).getRank()); } - bool isBlockedApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1, 4, 5); + bool isBlockedApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1, 3, 4, 5); for (size_t i = 0; i < getParentEdges().size(); i++) { const auto &inShape = getInputShapeAtPort(i); - isBlockedApplicable = isBlockedApplicable && one_of(inShape.getRank(), 1, 4, 5); + isBlockedApplicable = isBlockedApplicable && one_of(inShape.getRank(), 1, 3, 4, 5); isBlockedApplicable = isBlockedApplicable && implication(inShape.getRank() != 1, getOutputShapeAtPort(0).getRank() == inShape.getRank()); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.cpp index 941c043d140..32b0fd6aaee 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_pooling_node.cpp @@ -86,7 +86,7 @@ std::vector MKLDNNPoolingNode::getAvailableFormatsForDims(co else if (dims.getRank() == 2) return {memory::format_tag::nc}; else if (dims.getRank() == 3) - return {memory::format_tag::tnc, memory::format_tag::ntc}; + return { memory::format_tag::nCw8c, memory::format_tag::nCw16c, memory::format_tag::nwc, memory::format_tag::ncw}; else if (dims.getRank() == 4) return {memory::format_tag::nChw8c, memory::format_tag::nChw16c, memory::format_tag::nhwc, memory::format_tag::nchw}; else if (dims.getRank() == 5) @@ -148,8 +148,8 @@ void MKLDNNPoolingNode::getSupportedDescriptors() { const auto &childShape = getOutputShapeAtPort(0); const size_t inputRank = getInputShapeAtPort(0).getRank(); - if ((inputRank < 4) || (inputRank > 5)) - IE_THROW() << "Pooling layer. Unsupported mode. Only 4D and 5D blobs are supported as input."; + if ((inputRank < 3) || (inputRank > 5)) + IE_THROW() << "Pooling layer. Unsupported mode. Only 3D, 4D and 5D blobs are supported as input."; initEffectivePad(MemoryDescUtils::makeDummyShape(parentShape), MemoryDescUtils::makeDummyShape(childShape)); @@ -159,17 +159,17 @@ void MKLDNNPoolingNode::getSupportedDescriptors() { if (outputDataType == memory::data_type::bf16) outputDataType = memory::data_type::f32; // i8 layers supports only ndhwc and nhwc layouts - const auto in_candidate = std::make_shared(parentShape, inputDataType, inputRank == 5 ? - memory::format_tag::ndhwc : memory::format_tag::nhwc); - const auto out_candidate = std::make_shared(childShape, outputDataType, inputRank == 5 ? - memory::format_tag::ndhwc : memory::format_tag::nhwc); + const auto in_candidate = std::make_shared(parentShape, inputDataType, inputRank == 3 ? + memory::format_tag::nwc : (inputRank == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc)); + const auto out_candidate = std::make_shared(childShape, outputDataType, inputRank == 3 ? + memory::format_tag::nwc : (inputRank == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc)); createDescriptor({ in_candidate }, { out_candidate }); - } else if ((inputRank == 4 || inputRank == 5) && parentShape.getDims()[1] == 1) { + } else if ((inputRank == 3 || inputRank == 4 || inputRank == 5) && parentShape.getDims()[1] == 1) { // WA. We should force planar layout since it provides better performance - const auto in_candidate = std::make_shared(parentShape, inputDataType, inputRank == 5 ? - memory::format_tag::ncdhw : memory::format_tag::nchw); - const auto out_candidate = std::make_shared(childShape, outputDataType, inputRank == 5 ? - memory::format_tag::ncdhw : memory::format_tag::nchw); + const auto in_candidate = std::make_shared(parentShape, inputDataType, inputRank == 3 ? + memory::format_tag::ncw : (inputRank == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw)); + const auto out_candidate = std::make_shared(childShape, outputDataType, inputRank == 3 ? + memory::format_tag::ncw : (inputRank == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw)); createDescriptor({ in_candidate }, { out_candidate }); } else { if (inputDataType != memory::data_type::bf16) { diff --git a/inference-engine/tests/functional/inference_engine/transformations/ngraph_1d_ops_reshape_test.cpp b/inference-engine/tests/functional/inference_engine/transformations/ngraph_1d_ops_reshape_test.cpp deleted file mode 100644 index 72bbbcf64a5..00000000000 --- a/inference-engine/tests/functional/inference_engine/transformations/ngraph_1d_ops_reshape_test.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include - -#include "common_test_utils/test_common.hpp" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "common_test_utils/ngraph_test_utils.hpp" - -#include - -using namespace testing; -using namespace ngraph; - -TEST(TransformationTests, ConvReshapeTest1) { - auto input = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 3, 64}, {1}); - auto w = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{6, 3, 3/*OIW*/}, {1}); - - std::shared_ptr f(nullptr); - { - ngraph::Strides strides{1}, dilations{1}; - ngraph::CoordinateDiff pads_begin{0}, pads_end{0}; - ngraph::Shape output_shape{1, 6, 62}; - auto conv = std::make_shared(input, w, strides, dilations, pads_begin, pads_end, ngraph::element::f32, 1); - - f = std::make_shared(ngraph::NodeVector{conv}, ngraph::ParameterVector{}); - ngraph::pass::Manager manager; - manager.register_pass(); - manager.register_pass(); - manager.register_pass([](std::shared_ptr f) { - check_rt_info(f); - }); - manager.register_pass(); - ASSERT_NO_THROW(manager.run_passes(f)); - } - - std::vector ref_shape{1, 6, 1, 62}; - ngraph::Strides ref_strides{1, 1}; - ngraph::CoordinateDiff ref_pads_begin{0, 0}, ref_pads_end{0, 0}; - for (auto op : f->get_ops()) { - if (auto conv = ngraph::as_type_ptr(op)) { - ASSERT_EQ(conv->get_shape(), ref_shape); - ASSERT_EQ(conv->get_strides(), ref_strides); - ASSERT_EQ(conv->get_dilations(), ref_strides); - ASSERT_EQ(conv->get_pads_begin(), ref_pads_begin); - ASSERT_EQ(conv->get_pads_end(), ref_pads_end); - } - } -} - -TEST(TransformationTests, ConvBiasReshapeTest1) { - auto input = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 3, 64}, {1}); - auto w = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{6, 3, 3/*OIW*/}, {1}); - auto b = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{6}, {1}); - - std::shared_ptr f(nullptr); - { - ngraph::Strides strides{1}, dilations{1}; - ngraph::CoordinateDiff pads_begin{0}, pads_end{0}; - ngraph::Shape output_shape{1, 6, 62}; - auto conv = std::make_shared(input, w, b, strides, dilations, pads_begin, pads_end, ngraph::element::f32, 1); - - f = std::make_shared(ngraph::NodeVector{conv}, ngraph::ParameterVector{}); - ngraph::pass::Manager manager; - manager.register_pass(); - manager.register_pass(); - manager.register_pass([](std::shared_ptr f) { - check_rt_info(f); - }); - manager.register_pass(); - ASSERT_NO_THROW(manager.run_passes(f)); - } - - std::vector ref_shape{1, 6, 1, 62}; - ngraph::Strides ref_strides{1, 1}; - ngraph::CoordinateDiff ref_pads_begin{0, 0}, ref_pads_end{0, 0}; - for (auto op : f->get_ops()) { - if (auto conv = ngraph::as_type_ptr(op)) { - ASSERT_EQ(conv->get_shape(), ref_shape); - ASSERT_EQ(conv->get_strides(), ref_strides); - ASSERT_EQ(conv->get_dilations(), ref_strides); - ASSERT_EQ(conv->get_pads_begin(), ref_pads_begin); - ASSERT_EQ(conv->get_pads_end(), ref_pads_end); - } - } -} - -TEST_F(TransformationTestsF, MaxPoolReshapeTest1) { - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{1, 3, 64}); - - ngraph::Strides strides{1}; - ngraph::Shape pads_begin{0}, pads_end{0}, kernel{3}; - auto pool = std::make_shared(input, strides, pads_begin, pads_end, kernel, ngraph::op::RoundingType::FLOOR); - - function = std::make_shared(ngraph::NodeVector{pool}, ngraph::ParameterVector{input}); - manager.register_pass(); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{1, 3, 64}); - - auto reshape_begin = std::make_shared(input, opset1::Constant::create(element::i64, Shape{4}, {1, 3, 1, 64}), true); - - ngraph::Strides strides{1, 1}; - ngraph::Shape pads_begin{0, 0}, pads_end{0, 0}, kernel{1, 3}; - auto pool = std::make_shared(reshape_begin, strides, pads_begin, pads_end, kernel, ngraph::op::RoundingType::FLOOR); - - auto reshape_end = std::make_shared(pool, opset1::Constant::create(element::i64, Shape{3}, {1, 3, 62}), true); - - function_ref = std::make_shared(ngraph::NodeVector{reshape_end}, ngraph::ParameterVector{input}); - } -} - -TEST_F(TransformationTestsF, AvgPoolReshapeTest1) { - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{1, 3, 64}); - - ngraph::Strides strides{1}; - ngraph::Shape pads_begin{0}, pads_end{0}, kernel{3}; - auto pool = std::make_shared(input, strides, pads_begin, pads_end, kernel, false, ngraph::op::RoundingType::FLOOR); - - function = std::make_shared(ngraph::NodeVector{pool}, ngraph::ParameterVector{input}); - manager.register_pass(); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{1, 3, 64}); - - auto reshape_begin = std::make_shared(input, opset1::Constant::create(element::i64, Shape{4}, {1, 3, 1, 64}), true); - - ngraph::Strides strides{1, 1}; - ngraph::Shape pads_begin{0, 0}, pads_end{0, 0}, kernel{1, 3}; - auto pool = std::make_shared(reshape_begin, strides, pads_begin, pads_end, kernel, false, ngraph::op::RoundingType::FLOOR); - - auto reshape_end = std::make_shared(pool, opset1::Constant::create(element::i64, Shape{3}, {1, 3, 62}), true); - - function_ref = std::make_shared(ngraph::NodeVector{reshape_end}, ngraph::ParameterVector{input}); - } -} - -TEST(TransformationTests, ReshapeDynamicTest1) { - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic()); - - ngraph::Strides strides{1}; - ngraph::Shape pads_begin{0}, pads_end{0}, kernel{3}; - auto pool = std::make_shared(input, strides, pads_begin, pads_end, kernel, false, ngraph::op::RoundingType::FLOOR); - - auto f = std::make_shared(ngraph::NodeVector{pool}, ngraph::ParameterVector{input}); - pass::Manager manager; - manager.register_pass(); - ASSERT_NO_THROW(manager.run_passes(f)); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{1, 3, 64}); - - ngraph::Strides strides{1}; - ngraph::Shape pads_begin{0}, pads_end{0}, kernel{3}; - auto pool = std::make_shared(input, strides, pads_begin, pads_end, kernel, ngraph::op::RoundingType::FLOOR); - - auto f = std::make_shared(ngraph::NodeVector{pool}, ngraph::ParameterVector{input}); - pass::Manager manager; - manager.register_pass(); - ASSERT_NO_THROW(manager.run_passes(f)); - } - - { - auto input = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 3, 64}, {1}); - auto w = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{6, 3, 3/*OIW*/}, {1}); - auto b = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{6}, {1}); - ngraph::Strides strides{1}, dilations{1}; - ngraph::CoordinateDiff pads_begin{0}, pads_end{0}; - ngraph::Shape output_shape{1, 6, 62}; - auto conv = std::make_shared(input, w, b, strides, dilations, pads_begin, pads_end, 1); - - auto f = std::make_shared(ngraph::NodeVector{conv}, ngraph::ParameterVector{}); - pass::Manager manager; - manager.register_pass(); - ASSERT_NO_THROW(manager.run_passes(f)); - } -} \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/activation.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/activation.cpp index 5dd844586d6..af51d9ce422 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/activation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/activation.cpp @@ -150,6 +150,36 @@ const std::map>> activationTypes {GeluTanh, {{}}} }; +std::vector netPrc = { + Precision::BF16, + Precision::FP32 +}; + +/* ============= Activation (1D) ============= */ +std::vector cpuParams_3D = { + CPUSpecificParams({nCw16c}, {nCw16c}, {}, {}), + CPUSpecificParams({nwc}, {nwc}, {}, {}), + CPUSpecificParams({ncw}, {ncw}, {}, {}) +}; + +std::vector> basic3D = { + {{2, 4, 4}}, + {{2, 17, 5}}, +}; + +const auto basicCases3D = ::testing::Combine( + ::testing::ValuesIn(static_shapes_to_test_representation(basic3D)), + ::testing::Values(activationShapes), + ::testing::ValuesIn(CommonTestUtils::combineParams(activationTypes)), + ::testing::ValuesIn(netPrc), + ::testing::Values(Precision::FP32), + ::testing::Values(Precision::FP32), + ::testing::ValuesIn(filterCPUSpecificParams(cpuParams_3D)) +); + +INSTANTIATE_TEST_SUITE_P(smoke_Activation3D_Eltwise_CPU_BF16, ActivationLayerCPUTest, basicCases3D, ActivationLayerCPUTest::getTestCaseName); + +/* ============= Activation (2D) ============= */ std::vector cpuParams_4D = { CPUSpecificParams({nChw16c}, {nChw16c}, {}, {}), CPUSpecificParams({nhwc}, {nhwc}, {}, {}), @@ -161,10 +191,6 @@ std::vector> basic4D = { {{2, 17, 5, 4}} }; -std::vector netPrc = { - Precision::BF16, - Precision::FP32 -}; const auto basicCases4D = ::testing::Combine( ::testing::ValuesIn(static_shapes_to_test_representation(basic4D)), @@ -178,6 +204,7 @@ const auto basicCases4D = ::testing::Combine( INSTANTIATE_TEST_SUITE_P(smoke_Activation4D_Eltwise_CPU_BF16, ActivationLayerCPUTest, basicCases4D, ActivationLayerCPUTest::getTestCaseName); +/* ============= Activation (3D) ============= */ std::vector cpuParams_5D = { CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {}), CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}), diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp index e3a29c20671..52d303d44aa 100755 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/convolution.cpp @@ -155,6 +155,8 @@ protected: PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16]) { selectedType += "_BF16"; rel_threshold = 1e-2f; + if (selectedType == "jit_gemm_BF16") + rel_threshold = 0.05f; } else { selectedType = makeSelectedTypeStr(selectedType, netType); } @@ -180,7 +182,7 @@ TEST_P(ConvolutionLayerCPUTest, CompareWithRefs) { // Skip tests for sse41 convolution where ic or oc cannot be exactly divided by the block size, // since tails processing for sse41 nspc layout is not supported yet (see 52736). - if (!inFmts.empty() && (inFmts.front() == nhwc || inFmts.front() == ndhwc) && selectedType.find("jit_sse") != std::string::npos) { + if (!inFmts.empty() && (inFmts.front() == nwc || inFmts.front() == nhwc || inFmts.front() == ndhwc) && selectedType.find("jit_sse") != std::string::npos) { auto inpChannels = function->get_parameters().front()->get_partial_shape()[1].get_length(); auto outChannels = function->get_output_partial_shape(0)[1].get_length(); if ((inpChannels % 8) || (outChannels % 8)) { @@ -229,11 +231,67 @@ const std::vector fusingParamsSetBF16{ }; /* ============= Convolution params (GEMM layout) ============= */ -const SizeVector numOutChannels_Gemm = {6 }; +const SizeVector numOutChannels_Gemm = { 6 }; /* ============= Convolution params (blocked and nspc layout) ============= */ const SizeVector numOutChannels = { 64, 63 }; +/* ============= Convolution params (1D) ============= */ +const std::vector kernels1d = { {3}, {1} }; +const std::vector strides1d = { {1}, {2} }; +const std::vector> padBegins1d = { {0}, {1} }; +const std::vector> padEnds1d = { {0} }; +const std::vector dilations1d = { {1}, {2} }; +std::vector inputShapes1d = { + {{}, {{ 2, 64, 7 }}}, + {{}, {{ 1, 67, 7 }}}, + { + //dynamic shape + { -1, 64, {1, 200} }, + { //target static shapes + { 2, 64, 7 }, + { 1, 64, 9 } + } + }, + { + //dynamic shape + { -1, 67, {1, 200} }, + { //target static shapes + { 2, 67, 7 }, + { 1, 67, 9 } + } + }, + { + //dynamic shape + { {1, 200}, 64, -1 }, + { //target static shapes + { 2, 64, 7 }, + { 1, 64, 5 } + } + } +}; +std::vector inputShapesPlain2Blocked1d = { + {{}, {{1, 1, 7}}}, + {{}, {{1, 2, 7}}}, + {{}, {{1, 3, 7}}}, + { + //dynamic shapes + {-1, 1, {1, 200}}, + { //target static shapes + {2, 1, 7}, + {1, 1, 9} + } + }, + { + //dynamic shapes + {-1, 3, {1, 200}}, + { //target static shapes + {2, 3, 7}, + {1, 3, 9} + } + } +}; + /* ============= Convolution params (2D) ============= */ const std::vector kernels2d = { {3, 3}, {1, 1} }; const std::vector strides2d = { {1, 1}, {2, 2} }; @@ -332,6 +390,76 @@ std::vector inputShapesPlain2Blocked3d = { /* ============= */ /* INSTANCES */ +/* ============= Convolution (Gemm 1D) ============= */ +const auto convParams_ExplicitPadding_GEMM_1D = ::testing::Combine( + ::testing::ValuesIn(kernels1d), + ::testing::ValuesIn(strides1d), + ::testing::ValuesIn(padBegins1d), + ::testing::ValuesIn(padEnds1d), + ::testing::ValuesIn(dilations1d), + ::testing::ValuesIn(numOutChannels_Gemm), + ::testing::Values(ngraph::op::PadType::EXPLICIT) +); + +const std::vector CPUParams_GEMM_1D = { + conv_gemm_1D, + conv_gemm_1D_nspc +}; + +std::vector inShapesGemm1D = { + {{}, {{ 2, 12, 7 }}}, + { + //dynamic shape + { {1, 200}, 12, {1, 200} }, + { //target static shapes + { 2, 12, 7 }, + { 1, 12, 5 } + } + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_GEMM_FP32, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_GEMM_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inShapesGemm1D), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_GEMM_1D)), + ::testing::ValuesIn(fusingParamsSet), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_GEMM_BF16, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_GEMM_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inShapesGemm1D), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_gemm_1D})), // todo: [AV] what about conv_gemm_1D_nspc? + ::testing::ValuesIn(fusingParamsSetBF16), + ::testing::Values(cpuBF16PluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_GEMM_I8, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_GEMM_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::i8), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inShapesGemm1D), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_GEMM_1D)), + ::testing::Values(fusingSum), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + /* ============= Convolution (Gemm 2D) ============= */ const auto convParams_ExplicitPadding_GEMM_2D = ::testing::Combine( ::testing::ValuesIn(kernels2d), @@ -576,6 +704,102 @@ INSTANTIATE_TEST_SUITE_P(Conv_3D_GEMM_I8_dilated, ConvolutionLayerCPUTest, ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); +/* ============= Convolution (1D) ============= */ +const auto convParams_ExplicitPadding_1D = ::testing::Combine( + ::testing::ValuesIn(kernels1d), + ::testing::ValuesIn(strides1d), + ::testing::ValuesIn(padBegins1d), + ::testing::ValuesIn(padEnds1d), + ::testing::ValuesIn(dilations1d), + ::testing::ValuesIn(numOutChannels), + ::testing::Values(ngraph::op::PadType::EXPLICIT) +); + +const std::vector CPUParams_1D = { + conv_sse42_1D, + conv_avx2_1D, + conv_avx512_1D, + conv_sse42_1D_nspc, + conv_avx2_1D_nspc, + conv_avx512_1D_nspc +}; + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_FP32, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D)), + ::testing::ValuesIn(fusingParamsSet), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_BF16, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_avx512_1D})), // todo: [AV] what about conv_avx512_1D_nspc? + ::testing::ValuesIn(fusingParamsSetBF16), + ::testing::Values(cpuBF16PluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_I8, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::i8), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D)), + ::testing::Values(fusingSum), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +const std::vector CPUParams_1D_plain_to_blocked = { + conv_sse42_plain_to_blocked_1D, + conv_avx2_plain_to_blocked_1D, + conv_avx512_plain_to_blocked_1D, +}; + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_PlainToBlocked_FP32, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapesPlain2Blocked1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D_plain_to_blocked)), + ::testing::Values(emptyFusingSpec), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_PlainToBlocked_BF16, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapesPlain2Blocked1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_avx512_plain_to_blocked_1D})), + ::testing::Values(emptyFusingSpec), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + /* ============= Convolution (2D) ============= */ const auto convParams_ExplicitPadding_2D = ::testing::Combine( ::testing::ValuesIn(kernels2d), @@ -696,7 +920,7 @@ const std::vector CPUParams_2D_plain_to_blocked = { conv_avx512_plain_to_blocked_2D, }; -INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_2D_FP32, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(smoke_Conv_2D_PlainToBlocked_FP32, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_ExplicitPadding_2D, @@ -710,7 +934,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_2D_FP32, ConvolutionLayerCPUT ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_2D_BF16, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(smoke_Conv_2D_PlainToBlocked_BF16, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_ExplicitPadding_2D, @@ -870,7 +1094,7 @@ const std::vector CPUParams_3D_plain_to_blocked = { conv_avx512_plain_to_blocked_3D, }; -INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_3D_FP32, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(smoke_Conv_3D_PlainToBlocked_FP32, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_ExplicitPadding_3D, @@ -884,7 +1108,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_3D_FP32, ConvolutionLayerCPUT ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_3D_BF16, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(smoke_Conv_3D_PlainToBlocked_BF16, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_ExplicitPadding_3D, @@ -926,6 +1150,69 @@ INSTANTIATE_TEST_SUITE_P(Conv_PlainToBlocked_3D_BF16_dilated, ConvolutionLayerCP ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); +/* ============= Kernel_1x1 (1D) ============= */ + +const auto convParams_ExplicitPadding_1x1_1D = ::testing::Combine( + ::testing::Values(SizeVector({1})), + ::testing::Values(SizeVector({1})), + ::testing::Values(std::vector({0})), + ::testing::Values(std::vector({0})), + ::testing::Values(SizeVector({1})), + ::testing::Values(63), + ::testing::Values(ngraph::op::PadType::EXPLICIT) +); + +const std::vector CPUParams_1x1_1D = { + conv_sse42_1D_1x1, + conv_avx2_1D_1x1, + conv_avx512_1D_1x1, + conv_sse42_1D_1x1_nspc, + conv_avx2_1D_1x1_nspc, + conv_avx512_1D_1x1_nspc +}; + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_1x1_FP32, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1x1_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1x1_1D)), + ::testing::ValuesIn(fusingParamsSet), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_1x1_BF16, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1x1_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_avx512_1D_1x1, conv_avx512_2D_1x1_nspc})), + ::testing::ValuesIn(fusingParamsSetBF16), + ::testing::Values(cpuBF16PluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_1x1_I8, ConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + convParams_ExplicitPadding_1x1_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::i8), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1x1_1D)), + ::testing::Values(fusingSum), + ::testing::Values(cpuEmptyPluginConfig)), + ConvolutionLayerCPUTest::getTestCaseName); + /* ============= Kernel_1x1 (2D) ============= */ const auto convParams_ExplicitPadding_1x1_2D = ::testing::Combine( @@ -989,56 +1276,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_2D_1x1_I8, ConvolutionLayerCPUTest, ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); -/* ============= Convolution (1D) ============= */ -/* ============= Convolution params (1D) ============= */ -const std::vector kernels1d = { {3} }; -const std::vector strides1d = { {1}, {2} }; -const std::vector> padBegins1d = { {0}, {1} }; -const std::vector> padEnds1d = { {0} }; -const std::vector dilations1d = { {1}, {2} }; - -const auto convParams_1D = ::testing::Combine( - ::testing::ValuesIn(kernels1d), - ::testing::ValuesIn(strides1d), - ::testing::ValuesIn(padBegins1d), - ::testing::ValuesIn(padEnds1d), - ::testing::ValuesIn(dilations1d), - ::testing::ValuesIn(numOutChannels), - ::testing::Values(ngraph::op::PadType::EXPLICIT) -); - -const std::vector CPUParams_1D = { - conv_sse42_1D, - conv_avx2_1D, - conv_avx512_1D -}; - -std::vector inShapes1D = { - {{}, {{ 2, 64, 7 }}}, - { - //dynamic shape - { {1, 200}, 64, -1 }, - { //target static shapes - { 2, 64, 7 }, - { 1, 64, 5 } - } - } -}; - -INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D, ConvolutionLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - convParams_1D, - ::testing::Values(ElementType::f32), - ::testing::Values(ElementType::f32), - ::testing::Values(ElementType::undefined), - ::testing::ValuesIn(inShapes1D), - ::testing::Values(CommonTestUtils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D)), - ::testing::Values(fusingAddPerChannel), - ::testing::Values(cpuEmptyPluginConfig)), - ConvolutionLayerCPUTest::getTestCaseName); - /* ============= Jit Planar ============= */ /* ============= Convolution planar params (2D) ============= */ @@ -1068,7 +1305,7 @@ const auto convParams_Planar_ExplicitPadding_2D_dilated = ::testing::Combine( ::testing::Values(ngraph::op::PadType::EXPLICIT) ); -INSTANTIATE_TEST_SUITE_P(smoke_Conv_Jit_Planar_2D_FP32, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(smoke_Conv_2D_Jit_Planar_FP32, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_Planar_ExplicitPadding_2D, @@ -1082,7 +1319,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_Jit_Planar_2D_FP32, ConvolutionLayerCPUTest, ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(Conv_Jit_Planar_2D_FP32_dilated, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(Conv_2D_Jit_Planar_FP32_dilated, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_Planar_ExplicitPadding_2D_dilated, @@ -1123,7 +1360,7 @@ const auto convParams_Planar_ExplicitPadding_3D_dilated = ::testing::Combine( ::testing::Values(ngraph::op::PadType::EXPLICIT) ); -INSTANTIATE_TEST_SUITE_P(smoke_Conv_Jit_Planar_3D_FP32, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(smoke_Conv_3D_Jit_Planar_FP32, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_Planar_ExplicitPadding_3D, @@ -1137,7 +1374,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_Jit_Planar_3D_FP32, ConvolutionLayerCPUTest, ::testing::Values(cpuEmptyPluginConfig)), ConvolutionLayerCPUTest::getTestCaseName); -INSTANTIATE_TEST_SUITE_P(Conv_Jit_Planar_3D_FP32_dilated, ConvolutionLayerCPUTest, +INSTANTIATE_TEST_SUITE_P(Conv_3D_Jit_Planar_FP32_dilated, ConvolutionLayerCPUTest, ::testing::Combine( ::testing::Combine( convParams_Planar_ExplicitPadding_3D_dilated, diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp index 6290e370b6d..ed20233d782 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp @@ -521,4 +521,4 @@ //INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_5D_dyn_param, EltwiseLayerCPUTest::getTestCaseName); // //} // namespace -//} // namespace CPULayerTestsDefinitions \ No newline at end of file +//} // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp index f329ab6eef0..f5e7942646e 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/group_convolution.cpp @@ -253,6 +253,13 @@ const SizeVector numGroups_Blocked = {2, 4}; const SizeVector numOutChannels_DW = {32}; const SizeVector numGroups_DW = {32}; +/* ============= GroupConvolution params (1D) ============= */ +const std::vector kernels1d = { {3}, {1} }; +const std::vector strides1d = { {1}, {2} }; +const std::vector> padBegins1d = { {0}, {1} }; +const std::vector> padEnds1d = { {0} }; +const std::vector dilations1d = { {1}, {2} }; + /* ============= GroupConvolution params (2D) ============= */ const std::vector kernels2d = {{3, 3}, {1, 1}}; const std::vector strides2d = {{1, 1}, {2, 2}}; @@ -270,6 +277,63 @@ const std::vector dilations3d = {{1, 1, 1}, {2, 2, 2}}; /* INSTANCES */ +/* ============= GroupConvolution (GEMM 1D) ============= */ +const auto groupConvParams_ExplicitPadding_Gemm_1D = ::testing::Combine( + ::testing::ValuesIn(kernels1d), + ::testing::ValuesIn(strides1d), + ::testing::ValuesIn(padBegins1d), + ::testing::ValuesIn(padEnds1d), + ::testing::ValuesIn(dilations1d), + ::testing::ValuesIn(numOutChannels_Gemm), + ::testing::ValuesIn(numGroups_Gemm), + ::testing::Values(ngraph::op::PadType::EXPLICIT) +); + +const std::vector CPUParams_Gemm_1D = { + conv_gemm_1D, + conv_gemm_1D_nspc +}; + +std::vector inShapesGemm1D = { + {{}, {{ 2, 12, 7 }}}, + { + //dynamic shape + {{1, 200}, 12, {1, 200}}, + { //target static shapes + { 2, 12, 7 }, + { 1, 12, 5 } + } + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_Gemm_FP32, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_Gemm_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inShapesGemm1D), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_Gemm_1D)), + ::testing::ValuesIn(fusingParamsSet), + ::testing::Values(cpuEmptyPluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_Gemm_BF16, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_Gemm_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inShapesGemm1D), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_gemm_1D})), // todo: [AV] what about conv_gemm_1D_nspc? + ::testing::ValuesIn(fusingParamsSetBF16), + ::testing::Values(cpuBF16PluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + /* ============= GroupConvolution (GEMM 2D) ============= */ const auto groupConvParams_ExplicitPadding_Gemm_2D = ::testing::Combine( ::testing::ValuesIn(kernels2d), @@ -384,6 +448,89 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_3D_Gemm_BF16, GroupConvolutionLayerCPUT ::testing::Values(cpuBF16PluginConfig)), GroupConvolutionLayerCPUTest::getTestCaseName); +/* ============= GroupConvolution (1D) ============= */ +const auto groupConvParams_ExplicitPadding_1D = ::testing::Combine( + ::testing::ValuesIn(kernels1d), + ::testing::ValuesIn(strides1d), + ::testing::ValuesIn(padBegins1d), + ::testing::ValuesIn(padEnds1d), + ::testing::ValuesIn(dilations1d), + ::testing::ValuesIn(numOutChannels_Blocked), + ::testing::ValuesIn(numGroups_Blocked), + ::testing::Values(ngraph::op::PadType::EXPLICIT) +); + +const std::vector CPUParams_1D = { + conv_sse42_1D, + conv_avx2_1D, + conv_avx512_1D, + conv_sse42_1D_nspc, + conv_avx2_1D_nspc, + conv_avx512_1D_nspc +}; + +std::vector inputShapes1d = { + {{}, {{ 2, 64, 7 }}}, + { + //dynamic shapes + {-1, 64, {1, 200}}, + { //target static shapes + { 2, 64, 7 }, + { 1, 64, 9 } + } + }, + { + //dynamic shapes + { {-1, 64, -1} }, + { //target static shapes + { 2, 64, 7 }, + { 1, 64, 14 } + } + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_FP32, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D)), + ::testing::ValuesIn(fusingParamsSet), + ::testing::Values(cpuEmptyPluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_FP32_fusingBias, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D)), + ::testing::Values(fusingAddPerChannel), + ::testing::Values(cpuEmptyPluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_BF16, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1d), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_avx512_1D})), // todo: [AV] what about conv_avx512_1D_nspc? + ::testing::ValuesIn(fusingParamsSetBF16), + ::testing::Values(cpuBF16PluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + /* ============= GroupConvolution (2D) ============= */ const auto groupConvParams_ExplicitPadding_2D = ::testing::Combine( ::testing::ValuesIn(kernels2d), @@ -505,6 +652,71 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_3D_BF16, GroupConvolutionLayerCPUTest, ::testing::Values(cpuBF16PluginConfig)), GroupConvolutionLayerCPUTest::getTestCaseName); +/* ============= GroupConvolution (DW 1D) ============= */ +const auto groupConvParams_ExplicitPadding_DW_1D = ::testing::Combine( + ::testing::ValuesIn(kernels1d), + ::testing::ValuesIn(strides1d), + ::testing::ValuesIn(padBegins1d), + ::testing::ValuesIn(padEnds1d), + ::testing::ValuesIn(dilations1d), + ::testing::ValuesIn(numOutChannels_DW), + ::testing::ValuesIn(numGroups_DW), + ::testing::Values(ngraph::op::PadType::EXPLICIT) +); + +const std::vector CPUParams_DW_1D = { + conv_sse42_dw_1D, + conv_avx2_dw_1D, + conv_avx512_dw_1D, + conv_sse42_dw_1D_nspc, + conv_avx2_dw_1D_nspc, + conv_avx512_dw_1D_nspc +}; + +std::vector inputShapes1dDW = { + {{}, {{ 2, 32, 7 }}}, + { + //dynamic shapes + {-1, 32, {1, 200}}, + { //target static shapes + { 2, 32, 7 }, + { 1, 32, 9 } + } + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_DW_FP32, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_DW_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1dDW), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_sse42_dw_1D, + conv_avx2_dw_1D, + conv_avx512_dw_1D})), // todo: [AV] what about conv_sse42_dw_1D_nspc, + // conv_avx2_dw_1D_nspc, conv_avx512_dw_1D_nspc? + ::testing::ValuesIn(fusingParamsSet), + ::testing::Values(cpuEmptyPluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + + +INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D_DW_BF16, GroupConvolutionLayerCPUTest, + ::testing::Combine( + ::testing::Combine( + groupConvParams_ExplicitPadding_DW_1D, + ::testing::Values(ElementType::f32), + ::testing::Values(ElementType::undefined), + ::testing::Values(ElementType::undefined), + ::testing::ValuesIn(inputShapes1dDW), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + ::testing::ValuesIn(filterCPUInfoForDevice({conv_avx512_dw_1D})), // todo: [AV] what about conv_avx512_dw_1D_nspc? + ::testing::ValuesIn(fusingParamsSetBF16), + ::testing::Values(cpuBF16PluginConfig)), + GroupConvolutionLayerCPUTest::getTestCaseName); + /* ============= GroupConvolution (DW 2D) ============= */ const auto groupConvParams_ExplicitPadding_DW_2D = ::testing::Combine( ::testing::ValuesIn(kernels2d), @@ -965,57 +1177,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_JIT_AVX512_DW_GroupConv, GroupConvolutionLayerCPU /* ============= JIT AVX5122 PLANAR Convolution (not supported with groups) ============= */ /* ============================================= */ -/* ============= Convolution (1D) ============= */ -/* ============= Convolution params (1D) ============= */ -const std::vector kernels1d = { {3} }; -const std::vector strides1d = { {1}, {2} }; -const std::vector> padBegins1d = { {0}, {1} }; -const std::vector> padEnds1d = { {0} }; -const std::vector dilations1d = { {1}, {2} }; - -const auto convParams_1D = ::testing::Combine( - ::testing::ValuesIn(kernels1d), - ::testing::ValuesIn(strides1d), - ::testing::ValuesIn(padBegins1d), - ::testing::ValuesIn(padEnds1d), - ::testing::ValuesIn(dilations1d), - ::testing::ValuesIn(numOutChannels_Blocked), - ::testing::ValuesIn(numGroups_Blocked), - ::testing::Values(ngraph::op::PadType::EXPLICIT) -); - -const std::vector CPUParams_1D = { - conv_sse42_1D, - conv_avx2_1D, - conv_avx512_1D -}; - -std::vector inputShapes1d = { - {{}, {{ 2, 64, 7 }}}, - { - //dynamic shapes - { {-1, 64, -1} }, - { //target static shapes - { 2, 64, 7 }, - { 1, 64, 14 } - } - } -}; - -INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_1D, GroupConvolutionLayerCPUTest, - ::testing::Combine( - ::testing::Combine( - convParams_1D, - ::testing::Values(ElementType::f32), - ::testing::Values(ElementType::f32), - ::testing::Values(ElementType::undefined), - ::testing::ValuesIn(inputShapes1d), - ::testing::Values(CommonTestUtils::DEVICE_CPU)), - ::testing::ValuesIn(filterCPUInfoForDevice(CPUParams_1D)), - ::testing::Values(fusingAddPerChannel), - ::testing::Values(cpuEmptyPluginConfig)), - GroupConvolutionLayerCPUTest::getTestCaseName); - } // namespace } // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/pooling.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/pooling.cpp index 564ecef0348..7b77296facc 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/pooling.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/pooling.cpp @@ -141,6 +141,34 @@ const auto ref = CPUSpecificParams{{}, {}, {"ref_any"}, "ref_any"}; const std::vector vecCpuConfigs = {ref, sse42, avx, avx512}; const std::vector inpOutPrecision = {ElementType::f32/*, ElementType::bf16*/}; +const std::vector inputShapes3D = { + { {}, {{3, 4, 64}} }, + { {}, {{2, 8, 12}} }, + { {}, {{1, 16, 12}} }, + { {}, {{1, 21, 4}} }, + { {}, {{1, 32, 8}} }, + { + // dynamic + {-1, -1, -1}, + // target + { + {1, 32, 8}, + {1, 21, 4}, + {2, 8, 12} + } + }, + { + // dynamic + {{1, 5}, {4, 32}, {1, 64}}, + // target + { + {3, 4, 64}, + {1, 16, 12}, + {1, 32, 8} + } + } +}; + const std::vector inputShapes4D = { { {}, {{3, 4, 64, 64}} }, { {}, {{2, 8, 8, 12}} }, @@ -197,6 +225,61 @@ const std::vector inputShapes5D = { } }; +/* ============= Pooling (1D) ============= */ +const std::vector paramsMax3D = { + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2}, {2}, {0}, {0}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::EXPLICIT, false }, + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {4}, {2}, {0}, {0}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::EXPLICIT, false }, + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2}, {1}, {0}, {0}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::EXPLICIT, false }, +}; + +const std::vector paramsAvg3D = { + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::AVG, {3}, {1}, {1}, {0}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::SAME_UPPER, false }, + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::AVG, {3}, {1}, {1}, {0}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::EXPLICIT, true }, + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::AVG, {4}, {4}, {2}, {2}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::EXPLICIT, true }, +}; + +const std::vector paramsAvg3D_RefOnly = { + LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::AVG, {2}, {2}, {2}, {2}, + ngraph::op::RoundingType::CEIL, ngraph::op::PadType::EXPLICIT, false }, +}; + +INSTANTIATE_TEST_SUITE_P(smoke_MaxPool_CPU_3D, PoolingLayerCPUTest, + ::testing::Combine( + ::testing::ValuesIn(paramsMax3D), + ::testing::ValuesIn(inputShapes3D), + ::testing::ValuesIn(inpOutPrecision), + ::testing::Values(false), + ::testing::ValuesIn(filterCPUInfoForDevice(vecCpuConfigs)), + ::testing::Values(emptyFusingSpec)), + PoolingLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_AvgPool_CPU_3D, PoolingLayerCPUTest, + ::testing::Combine( + ::testing::ValuesIn(paramsAvg3D), + ::testing::ValuesIn(inputShapes3D), + ::testing::ValuesIn(inpOutPrecision), + ::testing::Values(false), + ::testing::ValuesIn(filterCPUInfoForDevice(vecCpuConfigs)), + ::testing::Values(emptyFusingSpec)), + PoolingLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_AvgPool_CPU_3D_NotOptimized, PoolingLayerCPUTest, + ::testing::Combine( + ::testing::ValuesIn(paramsAvg3D_RefOnly), + ::testing::ValuesIn(inputShapes3D), + ::testing::ValuesIn(inpOutPrecision), + ::testing::Values(false), + ::testing::Values(ref), + ::testing::Values(emptyFusingSpec)), + PoolingLayerCPUTest::getTestCaseName); + +/* ============= Pooling (2D) ============= */ const std::vector paramsMax4D = { LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2, 2}, {2, 2}, {0, 0}, {0, 0}, ngraph::op::RoundingType::CEIL, ngraph::op::PadType::SAME_LOWER, false }, @@ -258,6 +341,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AvgPool_CPU_4D_NotOptimized, PoolingLayerCPUTest, ::testing::Values(emptyFusingSpec)), PoolingLayerCPUTest::getTestCaseName); +/* ============= Pooling (3D) ============= */ const std::vector paramsMax5D = { LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2, 2, 2}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}, ngraph::op::RoundingType::CEIL, ngraph::op::PadType::SAME_LOWER, false }, diff --git a/inference-engine/tests/functional/plugin/cpu/test_utils/convolution_params.hpp b/inference-engine/tests/functional/plugin/cpu/test_utils/convolution_params.hpp index 762b19ed4a7..789d19850cd 100644 --- a/inference-engine/tests/functional/plugin/cpu/test_utils/convolution_params.hpp +++ b/inference-engine/tests/functional/plugin/cpu/test_utils/convolution_params.hpp @@ -7,62 +7,86 @@ #include "cpu_test_utils.hpp" namespace CPUTestUtils { - const auto conv_sse42_1D = CPUSpecificParams{{}, {}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_avx2_1D = CPUSpecificParams{{}, {}, {"jit_avx2"}, "jit_avx2"}; - const auto conv_avx512_1D = CPUSpecificParams{{}, {}, {"jit_avx512"}, "jit_avx512"}; - + const auto conv_ref_1D = CPUSpecificParams{{ncw}, {ncw}, {"ref_any"}, "ref_any"}; const auto conv_ref_2D = CPUSpecificParams{{nchw}, {nchw}, {"ref_any"}, "ref_any"}; const auto conv_ref_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"ref_any"}, "ref_any"}; + const auto conv_gemm_1D = CPUSpecificParams{{ncw}, {ncw}, {"gemm_any"}, "jit_gemm"}; const auto conv_gemm_2D = CPUSpecificParams{{nchw}, {nchw}, {"gemm_any"}, "jit_gemm"}; const auto conv_gemm_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"gemm_any"}, "jit_gemm"}; + const auto conv_gemm_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_gemm"}, "jit_gemm"}; const auto conv_gemm_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_gemm"}, "jit_gemm"}; const auto conv_gemm_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_gemm"}, "jit_gemm"}; + const auto conv_sse42_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_sse42"}, "jit_sse42"}; const auto conv_sse42_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42"}, "jit_sse42"}; const auto conv_sse42_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"}; + const auto conv_sse42_dw_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_sse42_dw"}, "jit_sse42_dw"}; const auto conv_sse42_dw_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42_dw"}, "jit_sse42_dw"}; const auto conv_sse42_dw_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_sse42_dw"}, "jit_sse42_dw"}; + const auto conv_sse42_plain_to_blocked_1D = CPUSpecificParams{{ncw}, {nCw8c}, {"jit_sse42"}, "jit_sse42"}; const auto conv_sse42_plain_to_blocked_2D = CPUSpecificParams{{nchw}, {nChw8c}, {"jit_sse42"}, "jit_sse42"}; const auto conv_sse42_plain_to_blocked_3D = CPUSpecificParams{{ncdhw}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"}; + const auto conv_sse42_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42"}, "jit_sse42"}; const auto conv_sse42_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42"}, "jit_sse42"}; const auto conv_sse42_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_sse42"}, "jit_sse42"}; + const auto conv_sse42_dw_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42_dw"}, "jit_sse42_dw"}; const auto conv_sse42_dw_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42_dw"}, "jit_sse42_dw"}; const auto conv_sse42_dw_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_sse42_dw"}, "jit_sse42_dw"}; + const auto conv_avx2_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_avx2"}, "jit_avx2"}; + const auto conv_avx2_dw_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_avx2_dw"}, "jit_avx2_dw"}; const auto conv_avx2_dw_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_avx2_dw"}, "jit_avx2_dw"}; const auto conv_avx2_dw_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_avx2_dw"}, "jit_avx2_dw"}; + const auto conv_avx2_planar_1D = CPUSpecificParams{{ncw}, {ncw}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_planar_2D = CPUSpecificParams{{nchw}, {nchw}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_planar_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"jit_avx2"}, "jit_avx2"}; + const auto conv_avx2_plain_to_blocked_1D = CPUSpecificParams{{ncw}, {nCw8c}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_plain_to_blocked_2D = CPUSpecificParams{{nchw}, {nChw8c}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_plain_to_blocked_3D = CPUSpecificParams{{ncdhw}, {nCdhw8c}, {"jit_avx2"}, "jit_avx2"}; + const auto conv_avx2_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_avx2"}, "jit_avx2"}; + const auto conv_avx2_dw_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx2_dw"}, "jit_avx2_dw"}; const auto conv_avx2_dw_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx2_dw"}, "jit_avx2_dw"}; const auto conv_avx2_dw_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_avx2_dw"}, "jit_avx2_dw"}; + const auto conv_avx512_1D = CPUSpecificParams{{nCw16c}, {nCw16c}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_2D = CPUSpecificParams{{nChw16c}, {nChw16c}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_3D = CPUSpecificParams{{nCdhw16c}, {nCdhw16c}, {"jit_avx512"}, "jit_avx512"}; + const auto conv_avx512_dw_1D = CPUSpecificParams{{nCw16c}, {nCw16c}, {"jit_avx512_dw"}, "jit_avx512_dw"}; const auto conv_avx512_dw_2D = CPUSpecificParams{{nChw16c}, {nChw16c}, {"jit_avx512_dw"}, "jit_avx512_dw"}; const auto conv_avx512_dw_3D = CPUSpecificParams{{nCdhw16c}, {nCdhw16c}, {"jit_avx512_dw"}, "jit_avx512_dw"}; + const auto conv_avx512_planar_1D = CPUSpecificParams{{ncw}, {ncw}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_planar_2D = CPUSpecificParams{{nchw}, {nchw}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_planar_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"jit_avx512"}, "jit_avx512"}; + const auto conv_avx512_plain_to_blocked_1D = CPUSpecificParams{{ncw}, {nCw16c}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_plain_to_blocked_2D = CPUSpecificParams{{nchw}, {nChw16c}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_plain_to_blocked_3D = CPUSpecificParams{{ncdhw}, {nCdhw16c}, {"jit_avx512"}, "jit_avx512"}; + const auto conv_avx512_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx512"}, "jit_avx512"}; const auto conv_avx512_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_avx512"}, "jit_avx512"}; + const auto conv_avx512_dw_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx512_dw"}, "jit_avx512_dw"}; const auto conv_avx512_dw_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx512_dw"}, "jit_avx512_dw"}; const auto conv_avx512_dw_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_avx512_dw"}, "jit_avx512_dw"}; + const auto conv_sse42_1D_1x1 = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; + const auto conv_avx2_1D_1x1 = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; + const auto conv_avx512_1D_1x1 = CPUSpecificParams{{nCw16c}, {nCw16c}, {"jit_avx512_1x1"}, "jit_avx512_1x1"}; + + const auto conv_sse42_1D_1x1_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; + const auto conv_avx2_1D_1x1_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; + const auto conv_avx512_1D_1x1_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx512_1x1"}, "jit_avx512_1x1"}; + const auto conv_sse42_2D_1x1 = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; const auto conv_avx2_2D_1x1 = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; const auto conv_avx512_2D_1x1 = CPUSpecificParams{{nChw16c}, {nChw16c}, {"jit_avx512_1x1"}, "jit_avx512_1x1"}; diff --git a/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp b/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp index d92bcdfb1e1..8fd24783dfa 100644 --- a/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp +++ b/inference-engine/tests/functional/plugin/cpu/test_utils/cpu_test_utils.cpp @@ -308,6 +308,8 @@ std::string CPUTestsBase::makeSelectedTypeStr(std::string implString, ngraph::el std::vector filterCPUSpecificParams(std::vector ¶msVector) { auto adjustBlockedFormatByIsa = [](std::vector& formats) { for (int i = 0; i < formats.size(); i++) { + if (formats[i] == nCw16c) + formats[i] = nCw8c; if (formats[i] == nChw16c) formats[i] = nChw8c; if (formats[i] == nCdhw16c) diff --git a/inference-engine/tests/unit/cpu/reshape_1d_ops_test.cpp b/inference-engine/tests/unit/cpu/reshape_1d_ops_test.cpp deleted file mode 100644 index 99b42dbfebb..00000000000 --- a/inference-engine/tests/unit/cpu/reshape_1d_ops_test.cpp +++ /dev/null @@ -1,516 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include "common_test_utils/ngraph_test_utils.hpp" - -using namespace testing; -using namespace MKLDNNPlugin; - -TEST(TransformationTests, Reshape1DAvgPoolTest1) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto avgPool = std::make_shared( - input, - ngraph::Strides{ 1 }, - ngraph::Shape{ 1 }, - ngraph::Shape{ 0 }, - ngraph::Shape{ 2 }, - true); - - f = std::make_shared(ngraph::NodeVector{ avgPool }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto avg_pool = std::make_shared( - unsqueeze, - ngraph::Strides{ 1, 1 }, - ngraph::Shape{ 0, 1 }, - ngraph::Shape{ 0, 0 }, - ngraph::Shape{ 1, 2 }, - true); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(avg_pool, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DAvgPoolTest2) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto avgPool = std::make_shared( - input, - ngraph::Strides{ 1 }, - ngraph::Shape{ 1 }, - ngraph::Shape{ 0 }, - ngraph::Shape{ 2 }, - true); - - f = std::make_shared(ngraph::NodeVector{ avgPool }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto avg_pool = std::make_shared( - unsqueeze, - ngraph::Strides{ 1, 1 }, - ngraph::Shape{ 0, 1 }, - ngraph::Shape{ 0, 0 }, - ngraph::Shape{ 1, 2 }, - true); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(avg_pool, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DAvgPoolTest3) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16, 16 }); - auto avgPool = std::make_shared( - input, - ngraph::Strides{ 1, 1 }, - ngraph::Shape{ 1, 1 }, - ngraph::Shape{ 0, 0 }, - ngraph::Shape{ 2, 2 }, - true); - - f = std::make_shared(ngraph::NodeVector{ avgPool }, ngraph::ParameterVector{ input }); - f_ref = f; - - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DMaxPoolTest1) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto max_pool = std::make_shared( - input, - ngraph::Strides{ 1 }, - ngraph::Shape{ 1 }, - ngraph::Shape{ 0 }, - ngraph::Shape{ 2 }); - - f = std::make_shared(ngraph::NodeVector{ max_pool }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto max_pool = std::make_shared( - unsqueeze, - ngraph::Strides{ 1, 1 }, - ngraph::Shape{ 0, 1 }, - ngraph::Shape{ 0, 0 }, - ngraph::Shape{ 1, 2 }); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(max_pool, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DMaxPoolTest2) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto max_pool = std::make_shared( - input, - ngraph::Strides{ 1 }, - ngraph::Shape{ 1 }, - ngraph::Shape{ 0 }, - ngraph::Shape{ 2 }); - - f = std::make_shared(ngraph::NodeVector{ max_pool }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto max_pool = std::make_shared( - unsqueeze, - ngraph::Strides{ 1, 1 }, - ngraph::Shape{ 0, 1 }, - ngraph::Shape{ 0, 0 }, - ngraph::Shape{ 1, 2 }); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(max_pool, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DMaxPoolTest3) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic()); - auto max_pool = std::make_shared( - input, - ngraph::Strides{ 1 }, - ngraph::Shape{ 1 }, - ngraph::Shape{ 0 }, - ngraph::Shape{ 2 }); - - f = std::make_shared(ngraph::NodeVector{ max_pool }, ngraph::ParameterVector{ input }); - f_ref = f; - - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DConvolutionTest1) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 6, 3, 3 }, { 2.f }); - auto convolution = std::make_shared( - input, - weights, - ngraph::Strides{ 1 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::Strides{ 1 }); - - f = std::make_shared(ngraph::NodeVector{ convolution }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 6, 3, 1, 3 }, { 2.f }); - auto convolution = std::make_shared( - unsqueeze, - weights, - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(convolution, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DConvolutionTest2) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 6, 3, 3 }, { 2.f }); - auto convolution = std::make_shared( - input, - weights, - ngraph::Strides{ 1 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::Strides{ 1 }); - - auto bias_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 1, 6, 1 }, { 24.f }); - auto bias = std::make_shared(convolution, bias_const); - - f = std::make_shared(ngraph::NodeVector{ bias }, ngraph::ParameterVector{ input }); - - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 6, 3, 1, 3 }, { 2.f }); - auto convolution = std::make_shared( - unsqueeze, - weights, - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); - - auto bias_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 1, 6, 1, 1 }, { 24.f }); - auto bias = std::make_shared(convolution, bias_const); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(bias, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DConvolutionTest3) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::u8, ngraph::Shape{ 1, 3, 16 }); - auto weights = ngraph::opset1::Constant::create(ngraph::element::i8, ngraph::Shape{ 6, 3, 3 }, { 2.f }); - - auto relaxed_convolution = std::make_shared>( - ngraph::element::TypeVector{ngraph::element::f32, ngraph::element::f32}, - ngraph::element::TypeVector{ngraph::element::f32}, - ngraph::op::TemporaryReplaceOutputType(input, ngraph::element::f32).get(), - ngraph::op::TemporaryReplaceOutputType(weights, ngraph::element::f32).get(), - ngraph::Strides{ 1 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::Strides{ 1 }); - - f = std::make_shared(ngraph::NodeVector{ relaxed_convolution }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::u8, ngraph::Shape{ 1, 3, 16 }); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto weights = ngraph::opset1::Constant::create(ngraph::element::i8, ngraph::Shape{ 6, 3, 1, 3 }, { 2.f }); - auto relaxed_convolution = std::make_shared>( - ngraph::element::TypeVector{ ngraph::element::f32, ngraph::element::f32 }, - ngraph::element::TypeVector{ ngraph::element::f32 }, - ngraph::op::TemporaryReplaceOutputType(unsqueeze, ngraph::element::f32).get(), - ngraph::op::TemporaryReplaceOutputType(weights, ngraph::element::f32).get(), - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(relaxed_convolution, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DConvolutionTest4) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 6, 3, 3 }, { 2.f }); - auto convolution = std::make_shared( - input, - weights, - ngraph::Strides{ 1 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::Strides{ 1 }); - - auto bias_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 1, 6, 1 }, { 24.f }); - auto bias = std::make_shared(convolution, bias_const); - - f = std::make_shared(ngraph::NodeVector{ bias }, ngraph::ParameterVector{ input }); - - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 6, 3, 1, 3 }, { 2.f }); - auto convolution = std::make_shared( - unsqueeze, - weights, - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); - - auto bias_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 1, 6, 1, 1 }, { 24.f }); - auto bias = std::make_shared(convolution, bias_const); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(bias, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DGroupConvolutionTest1) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 3, 1, 1, 3 }, { 2.f }); - auto group_convolution = std::make_shared( - input, - weights, - ngraph::Strides{ 1 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::Strides{ 1 }); - - f = std::make_shared(ngraph::NodeVector{ group_convolution }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 }); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 3, 1, 1, 1, 3 }, { 2.f }); - auto group_convolution = std::make_shared( - unsqueeze, - weights, - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(group_convolution, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} - -TEST(TransformationTests, Reshape1DGroupConvolutionTest2) { - std::shared_ptr f(nullptr), f_ref(nullptr); - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 3, 1, 1, 3 }, { 2.f }); - auto group_convolution = std::make_shared( - input, - weights, - ngraph::Strides{ 1 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::CoordinateDiff{ 0 }, - ngraph::Strides{ 1 }); - - f = std::make_shared(ngraph::NodeVector{ group_convolution }, ngraph::ParameterVector{ input }); - ngraph::pass::Manager m; - m.register_pass(); - m.register_pass(); - m.run_passes(f); - } - - { - auto input = std::make_shared(ngraph::element::f32, ngraph::PartialShape::dynamic(3)); - auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto unsqueeze = std::make_shared(input, unsqueeze_const); - - auto weights = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{ 3, 1, 1, 1, 3 }, { 2.f }); - auto group_convolution = std::make_shared( - unsqueeze, - weights, - ngraph::Strides{ 1, 1 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::Strides{ 1, 1 }); - - auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 }); - auto squeeze = std::make_shared(group_convolution, squeeze_const); - - f_ref = std::make_shared(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input }); - } - - auto res = compare_functions(f, f_ref); - ASSERT_TRUE(res.first) << res.second; -} diff --git a/inference-engine/thirdparty/mkl-dnn b/inference-engine/thirdparty/mkl-dnn index deab85766ff..d5d0552538a 160000 --- a/inference-engine/thirdparty/mkl-dnn +++ b/inference-engine/thirdparty/mkl-dnn @@ -1 +1 @@ -Subproject commit deab85766ff3fb547ae34eeff94fca4e73bd3053 +Subproject commit d5d0552538a0962bd83161ca060220c82f8c4b49 diff --git a/src/bindings/python/tests/__init__.py b/src/bindings/python/tests/__init__.py index 7adc0ee60c0..26f987b5f60 100644 --- a/src/bindings/python/tests/__init__.py +++ b/src/bindings/python/tests/__init__.py @@ -139,5 +139,4 @@ xfail_issue_63136 = xfail_test(reason="Unsupported operation: CastLike") xfail_issue_63137 = xfail_test(reason="Unsupported operations: OptionalHasElement, OptionalGetElement") xfail_issue_63138 = xfail_test(reason="Missing ONNX Shape-15 support") xfail_issue_63643 = xfail_test(reason="RuntimeError: Unsupported operation of type: Convolution name") -xfail_issue_54663 = xfail_test(reason="Disabled until MaxPool-8 is supported on CPU") xfail_issue_68212 = xfail_test(reason="Unsupported reading model with bytes streams") diff --git a/src/bindings/python/tests/test_ngraph/test_ops.py b/src/bindings/python/tests/test_ngraph/test_ops.py index 5d3840864ca..7a209c1ca8b 100644 --- a/src/bindings/python/tests/test_ngraph/test_ops.py +++ b/src/bindings/python/tests/test_ngraph/test_ops.py @@ -10,7 +10,6 @@ from openvino.runtime.impl import AxisSet, Function, Shape, Type from openvino.runtime.impl.op import Constant, Parameter from tests.runtime import get_runtime -from tests import xfail_issue_54663 def binary_op(op_str, a, b): @@ -542,7 +541,6 @@ def test_select(): expected = np.array([[5, 8]]) assert np.allclose(result, expected) -@xfail_issue_54663 def test_max_pool(): # test 1d element_type = Type.f32 diff --git a/src/bindings/python/tests_compatibility/test_ngraph/test_ops.py b/src/bindings/python/tests_compatibility/test_ngraph/test_ops.py index fe6db2116dd..eedd5d51292 100644 --- a/src/bindings/python/tests_compatibility/test_ngraph/test_ops.py +++ b/src/bindings/python/tests_compatibility/test_ngraph/test_ops.py @@ -543,7 +543,6 @@ def test_select(): assert np.allclose(result, expected) -@xfail_issue_54663 def test_max_pool(): # test 1d element_type = Type.f32