[CPU] Native 1D models support (#8168)

This commit is contained in:
Alexey Varyzgin 2021-11-30 15:30:53 +03:00 committed by GitHub
parent d9acc137f8
commit 9b6b184e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 687 additions and 1126 deletions

View File

@ -457,7 +457,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndZeroPoints(MKLDNNGraph &graph) {
if (auto convNode = std::dynamic_pointer_cast<MKLDNNConvolutionNode>(node)) { if (auto convNode = std::dynamic_pointer_cast<MKLDNNConvolutionNode>(node)) {
auto rank = convNode->getInputShapeAtPort(0).getRank(); auto rank = convNode->getInputShapeAtPort(0).getRank();
// int8 depthwise convolution does not support fusing zero points in 3D case // 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; retVal = true;
} }
} }
@ -577,7 +577,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndZeroPoints(MKLDNNGraph &graph) {
ptrdiff_t OC = weightsConstantDims[0 + groupOffset]; ptrdiff_t OC = weightsConstantDims[0 + groupOffset];
ptrdiff_t IC = weightsConstantDims[1 + groupOffset]; ptrdiff_t IC = weightsConstantDims[1 + groupOffset];
ptrdiff_t KD = weightsConstantDims.size() == (5 + groupOffset) ? weightsConstantDims[weightsConstantDims.size() - 3] : 1; 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]; ptrdiff_t KW = weightsConstantDims[weightsConstantDims.size() - 1];
for (size_t g = 0; g < G; g++) { for (size_t g = 0; g < G; g++) {

View File

@ -491,7 +491,8 @@ std::vector<memory::format_tag> MKLDNNNode::getAvailableFormatsForDims(const Sha
else if (dims.getRank() == 2) else if (dims.getRank() == 2)
return {memory::format_tag::nc}; return {memory::format_tag::nc};
else if (dims.getRank() == 3) 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) else if (dims.getRank() == 4)
return {memory::format_tag::nchw, memory::format_tag::nChw8c, memory::format_tag::nChw16c}; return {memory::format_tag::nchw, memory::format_tag::nChw8c, memory::format_tag::nChw16c};
else if (dims.getRank() == 5) else if (dims.getRank() == 5)

View File

@ -6,7 +6,6 @@
#include "fc_bias_fusion.hpp" #include "fc_bias_fusion.hpp"
#include "ngraph/op/fake_quantize.hpp" #include "ngraph/op/fake_quantize.hpp"
#include "ngraph/pass/manager.hpp" #include "ngraph/pass/manager.hpp"
#include "reshape_1d_ops.hpp"
#include "reshape_fc_fusion.hpp" #include "reshape_fc_fusion.hpp"
#include "reshape_fully_connected.hpp" #include "reshape_fully_connected.hpp"
#include "align_matmul_input_ranks.hpp" #include "align_matmul_input_ranks.hpp"
@ -26,10 +25,6 @@ namespace MKLDNNPlugin {
inline void ConvertToCPUSpecificOpset(std::shared_ptr<ngraph::Function> &nGraphFunc) { inline void ConvertToCPUSpecificOpset(std::shared_ptr<ngraph::Function> &nGraphFunc) {
ngraph::pass::Manager manager; ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::ConstantFolding>(); manager.register_pass<ngraph::pass::ConstantFolding>();
manager.register_pass<Reshape1DConvolution>();
manager.register_pass<Reshape1DGroupConvolution>();
manager.register_pass<Reshape1DAvgPool>();
manager.register_pass<Reshape1DMaxPool>();
manager.register_pass<ConvertMatMulToFC>(); manager.register_pass<ConvertMatMulToFC>();
manager.register_pass<AlignMatMulInputRanks>(); manager.register_pass<AlignMatMulInputRanks>();
manager.register_pass<ConvertTileToSeqTiles>(); manager.register_pass<ConvertTileToSeqTiles>();

View File

@ -1,218 +0,0 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "reshape_1d_ops.hpp"
#include <memory>
#include <vector>
#include <numeric>
#include <ngraph/opsets/opset1.hpp>
#include <ngraph/rt_info.hpp>
#include <ngraph/pattern/op/wrap_type.hpp>
#include <ngraph_ops/type_relaxed.hpp>
#include "transformations/utils/utils.hpp"
namespace {
template <class BaseOp>
std::shared_ptr<ngraph::Node> convert(const ngraph::Output<ngraph::Node> & data, std::shared_ptr<BaseOp> 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<ngraph::opset1::Unsqueeze>(node->input_value(1), unsqueeze_const);
new_ops.push_back(weights);
if (std::dynamic_pointer_cast<ngraph::op::TypeRelaxedBase>(node)) {
return std::make_shared<ngraph::op::TypeRelaxed<BaseOp>>(std::vector<ngraph::element::Type>{ngraph::element::f32, ngraph::element::f32},
std::vector<ngraph::element::Type>{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<BaseOp>(data,
weights,
new_strides,
new_pads_begin,
new_pad_end,
new_dilations,
node->get_auto_pad());
}
}
template <>
std::shared_ptr<ngraph::Node> convert(const ngraph::Output<ngraph::Node> & data, std::shared_ptr<ngraph::opset1::MaxPool> 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<ngraph::opset1::MaxPool>(data,
new_strides,
new_pads_begin,
new_pad_end,
new_kernel,
node->get_rounding_type(),
node->get_auto_pad());
}
template <>
std::shared_ptr<ngraph::Node> convert(const ngraph::Output<ngraph::Node> & data, std::shared_ptr<ngraph::opset1::AvgPool> 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<ngraph::opset1::AvgPool>(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<ngraph::Node> last = std::make_shared<ngraph::opset1::Unsqueeze>(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<ngraph::opset1::Convolution>(node)) {
last = convert(last, conv, new_ops);
} else if (auto group_conv = std::dynamic_pointer_cast<ngraph::opset1::GroupConvolution>(node)) {
last = convert(last, group_conv, new_ops);
} else if (auto max_pool = std::dynamic_pointer_cast<ngraph::opset1::MaxPool>(node)) {
last = convert(last, max_pool, new_ops);
} else if (auto avg_pool = std::dynamic_pointer_cast<ngraph::opset1::AvgPool>(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<ngraph::Node> add_to_replace = nullptr;
std::shared_ptr<ngraph::Node> reshaped_add = nullptr;
ngraph::NodeVector bias_ops;
if (std::dynamic_pointer_cast<ngraph::opset1::Convolution>(node) || std::dynamic_pointer_cast<ngraph::opset1::GroupConvolution>(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<ngraph::opset1::Add>(add_to_replace) &&
std::dynamic_pointer_cast<ngraph::opset1::Constant>(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<ngraph::opset1::Reshape>(add_to_replace->input_value(1), new_shape_const, true);
reshaped_add = std::make_shared<ngraph::opset1::Add>(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<ngraph::opset1::Squeeze>(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<ngraph::opset1::Convolution>({ activations, weights });
auto m = std::make_shared<ngraph::pattern::Matcher>(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<ngraph::opset1::GroupConvolution>({ activations, weights });
auto m = std::make_shared<ngraph::pattern::Matcher>(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<ngraph::opset1::AvgPool>({ input });
auto m = std::make_shared<ngraph::pattern::Matcher>(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<ngraph::opset1::MaxPool>({ input });
auto m = std::make_shared<ngraph::pattern::Matcher>(pool, "Reshape1DMaxPool");
this->register_matcher(m, get_callback());
}

View File

@ -1,35 +0,0 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <ngraph/pass/graph_rewrite.hpp>
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

View File

@ -33,7 +33,7 @@ bool MKLDNNConvolutionNode::isSupportedOperation(const std::shared_ptr<const ngr
return false; return false;
} }
size_t ndims = op->get_input_partial_shape(0).rank().get_length(); size_t ndims = op->get_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); errorMessage = "Doesn't support 'data' input with rank: " + std::to_string(ndims);
return false; return false;
} }
@ -254,10 +254,10 @@ void MKLDNNConvolutionNode::getSupportedDescriptors() {
outputDataType = memory::data_type::f32; outputDataType = memory::data_type::f32;
if (eltwisePrecision == Precision::BF16) if (eltwisePrecision == Precision::BF16)
eltwisePrecision = Precision::FP32; eltwisePrecision = Precision::FP32;
in_candidate = std::make_shared<DnnlBlockedMemoryDesc>(getInputShapeAtPort(0), in_candidate = std::make_shared<DnnlBlockedMemoryDesc>(getInputShapeAtPort(0), inputDataType,
inputDataType, ndims == 5 ? memory::format_tag::ndhwc : memory::format_tag::nhwc); ndims == 3 ? memory::format_tag::nwc : (ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc));
out_candidate = std::make_shared<DnnlBlockedMemoryDesc>(getOutputShapeAtPort(0), out_candidate = std::make_shared<DnnlBlockedMemoryDesc>(getOutputShapeAtPort(0), outputDataType,
outputDataType, ndims == 5 ? memory::format_tag::ndhwc : memory::format_tag::nhwc); ndims == 3 ? memory::format_tag::nwc : (ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc));
createDescriptor({ in_candidate }, { out_candidate }); createDescriptor({ in_candidate }, { out_candidate });
} else { } else {
inputDataType = (getOriginalInputPrecisionAtPort(0) == Precision::BF16 inputDataType = (getOriginalInputPrecisionAtPort(0) == Precision::BF16
@ -289,11 +289,11 @@ void MKLDNNConvolutionNode::getSupportedDescriptors() {
eltwisePrecision = Precision::FP32; eltwisePrecision = Precision::FP32;
} }
if (one_of(ndims, 4, 5)) { if (one_of(ndims, 3, 4, 5)) {
memory::format_tag ncsp = ndims == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw; memory::format_tag nspc = ndims == 3 ? memory::format_tag::nwc : (ndims == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc);
memory::format_tag nspc = 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 nCsp16c = ndims == 4 ? memory::format_tag::nChw16c : memory::format_tag::nCdhw16c; memory::format_tag nCsp8c = ndims == 3 ? memory::format_tag::nCw8c : (ndims == 4 ? memory::format_tag::nChw8c : memory::format_tag::nCdhw8c);
memory::format_tag nCsp8c = 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 inputShape = getInputShapeAtPort(0);
auto outputShape = getOutputShapeAtPort(0); auto outputShape = getOutputShapeAtPort(0);
@ -830,7 +830,7 @@ bool MKLDNNConvolutionNode::isNspcAvailable() const {
if (isDepthWise()) { if (isDepthWise()) {
// 1d equivalent cases are painfully slow // 1d equivalent cases are painfully slow
if (1 == inpDims[inpDims.size() - 2]) { if (inpDims.size() == 3 || 1 == inpDims[inpDims.size() - 2]) {
return false; return false;
} }
} else { } else {

View File

@ -1238,18 +1238,18 @@ void MKLDNNEltwiseNode::initSupportedPrimitiveDescriptors() {
return {config, impl_type}; 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++) { 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, isChannelsFirstApplicable = isChannelsFirstApplicable && implication(getInputShapeAtPort(i).getRank() != 1,
getOutputShapeAtPort(0).getRank() == getOutputShapeAtPort(0).getRank() ==
getInputShapeAtPort(i).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++) { for (size_t i = 0; i < getParentEdges().size(); i++) {
const auto &inShape = getInputShapeAtPort(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, isBlockedApplicable = isBlockedApplicable && implication(inShape.getRank() != 1,
getOutputShapeAtPort(0).getRank() == getOutputShapeAtPort(0).getRank() ==
inShape.getRank()); inShape.getRank());

View File

@ -86,7 +86,7 @@ std::vector<memory::format_tag> MKLDNNPoolingNode::getAvailableFormatsForDims(co
else if (dims.getRank() == 2) else if (dims.getRank() == 2)
return {memory::format_tag::nc}; return {memory::format_tag::nc};
else if (dims.getRank() == 3) 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) else if (dims.getRank() == 4)
return {memory::format_tag::nChw8c, memory::format_tag::nChw16c, memory::format_tag::nhwc, memory::format_tag::nchw}; return {memory::format_tag::nChw8c, memory::format_tag::nChw16c, memory::format_tag::nhwc, memory::format_tag::nchw};
else if (dims.getRank() == 5) else if (dims.getRank() == 5)
@ -148,8 +148,8 @@ void MKLDNNPoolingNode::getSupportedDescriptors() {
const auto &childShape = getOutputShapeAtPort(0); const auto &childShape = getOutputShapeAtPort(0);
const size_t inputRank = getInputShapeAtPort(0).getRank(); const size_t inputRank = getInputShapeAtPort(0).getRank();
if ((inputRank < 4) || (inputRank > 5)) if ((inputRank < 3) || (inputRank > 5))
IE_THROW() << "Pooling layer. Unsupported mode. Only 4D and 5D blobs are supported as input."; IE_THROW() << "Pooling layer. Unsupported mode. Only 3D, 4D and 5D blobs are supported as input.";
initEffectivePad(MemoryDescUtils::makeDummyShape(parentShape), initEffectivePad(MemoryDescUtils::makeDummyShape(parentShape),
MemoryDescUtils::makeDummyShape(childShape)); MemoryDescUtils::makeDummyShape(childShape));
@ -159,17 +159,17 @@ void MKLDNNPoolingNode::getSupportedDescriptors() {
if (outputDataType == memory::data_type::bf16) if (outputDataType == memory::data_type::bf16)
outputDataType = memory::data_type::f32; outputDataType = memory::data_type::f32;
// i8 layers supports only ndhwc and nhwc layouts // i8 layers supports only ndhwc and nhwc layouts
const auto in_candidate = std::make_shared<DnnlBlockedMemoryDesc>(parentShape, inputDataType, inputRank == 5 ? const auto in_candidate = std::make_shared<DnnlBlockedMemoryDesc>(parentShape, inputDataType, inputRank == 3 ?
memory::format_tag::ndhwc : memory::format_tag::nhwc); memory::format_tag::nwc : (inputRank == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc));
const auto out_candidate = std::make_shared<DnnlBlockedMemoryDesc>(childShape, outputDataType, inputRank == 5 ? const auto out_candidate = std::make_shared<DnnlBlockedMemoryDesc>(childShape, outputDataType, inputRank == 3 ?
memory::format_tag::ndhwc : memory::format_tag::nhwc); memory::format_tag::nwc : (inputRank == 4 ? memory::format_tag::nhwc : memory::format_tag::ndhwc));
createDescriptor({ in_candidate }, { out_candidate }); 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 // WA. We should force planar layout since it provides better performance
const auto in_candidate = std::make_shared<DnnlBlockedMemoryDesc>(parentShape, inputDataType, inputRank == 5 ? const auto in_candidate = std::make_shared<DnnlBlockedMemoryDesc>(parentShape, inputDataType, inputRank == 3 ?
memory::format_tag::ncdhw : memory::format_tag::nchw); memory::format_tag::ncw : (inputRank == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw));
const auto out_candidate = std::make_shared<DnnlBlockedMemoryDesc>(childShape, outputDataType, inputRank == 5 ? const auto out_candidate = std::make_shared<DnnlBlockedMemoryDesc>(childShape, outputDataType, inputRank == 3 ?
memory::format_tag::ncdhw : memory::format_tag::nchw); memory::format_tag::ncw : (inputRank == 4 ? memory::format_tag::nchw : memory::format_tag::ncdhw));
createDescriptor({ in_candidate }, { out_candidate }); createDescriptor({ in_candidate }, { out_candidate });
} else { } else {
if (inputDataType != memory::data_type::bf16) { if (inputDataType != memory::data_type::bf16) {

View File

@ -1,197 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include "common_test_utils/test_common.hpp"
#include <string>
#include <sstream>
#include <fstream>
#include <memory>
#include <map>
#include <ngraph/function.hpp>
#include <ngraph/op/constant.hpp>
#include <ngraph_ops/convolution_ie.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/reshape_1d_ops.hpp>
#include <transformations/init_node_info.hpp>
#include <ngraph/opsets/opset1.hpp>
#include <ngraph/pass/manager.hpp>
#include "common_test_utils/ngraph_test_utils.hpp"
#include <ngraph/pass/manager.hpp>
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<ngraph::Function> 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<ngraph::op::ConvolutionIE>(input, w, strides, dilations, pads_begin, pads_end, ngraph::element::f32, 1);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv}, ngraph::ParameterVector{});
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::Reshape1DOps>();
manager.register_pass<ngraph::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
check_rt_info(f);
});
manager.register_pass<ngraph::pass::ConstantFolding>();
ASSERT_NO_THROW(manager.run_passes(f));
}
std::vector<size_t> 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<ngraph::op::ConvolutionIE>(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<ngraph::Function> 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<ngraph::op::ConvolutionIE>(input, w, b, strides, dilations, pads_begin, pads_end, ngraph::element::f32, 1);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv}, ngraph::ParameterVector{});
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::Reshape1DOps>();
manager.register_pass<ngraph::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
check_rt_info(f);
});
manager.register_pass<ngraph::pass::ConstantFolding>();
ASSERT_NO_THROW(manager.run_passes(f));
}
std::vector<size_t> 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<ngraph::op::ConvolutionIE>(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<opset1::Parameter>(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<ngraph::opset1::MaxPool>(input, strides, pads_begin, pads_end, kernel, ngraph::op::RoundingType::FLOOR);
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{pool}, ngraph::ParameterVector{input});
manager.register_pass<ngraph::pass::Reshape1DOps>();
}
{
auto input = std::make_shared<opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 64});
auto reshape_begin = std::make_shared<opset1::Reshape>(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<ngraph::opset1::MaxPool>(reshape_begin, strides, pads_begin, pads_end, kernel, ngraph::op::RoundingType::FLOOR);
auto reshape_end = std::make_shared<opset1::Reshape>(pool, opset1::Constant::create(element::i64, Shape{3}, {1, 3, 62}), true);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{reshape_end}, ngraph::ParameterVector{input});
}
}
TEST_F(TransformationTestsF, AvgPoolReshapeTest1) {
{
auto input = std::make_shared<opset1::Parameter>(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<ngraph::opset1::AvgPool>(input, strides, pads_begin, pads_end, kernel, false, ngraph::op::RoundingType::FLOOR);
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{pool}, ngraph::ParameterVector{input});
manager.register_pass<ngraph::pass::Reshape1DOps>();
}
{
auto input = std::make_shared<opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 64});
auto reshape_begin = std::make_shared<opset1::Reshape>(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<ngraph::opset1::AvgPool>(reshape_begin, strides, pads_begin, pads_end, kernel, false, ngraph::op::RoundingType::FLOOR);
auto reshape_end = std::make_shared<opset1::Reshape>(pool, opset1::Constant::create(element::i64, Shape{3}, {1, 3, 62}), true);
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{reshape_end}, ngraph::ParameterVector{input});
}
}
TEST(TransformationTests, ReshapeDynamicTest1) {
{
auto input = std::make_shared<opset1::Parameter>(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<ngraph::opset1::AvgPool>(input, strides, pads_begin, pads_end, kernel, false, ngraph::op::RoundingType::FLOOR);
auto f = std::make_shared<ngraph::Function>(ngraph::NodeVector{pool}, ngraph::ParameterVector{input});
pass::Manager manager;
manager.register_pass<ngraph::pass::Reshape1DOps>();
ASSERT_NO_THROW(manager.run_passes(f));
}
{
auto input = std::make_shared<opset1::Parameter>(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<ngraph::opset1::MaxPool>(input, strides, pads_begin, pads_end, kernel, ngraph::op::RoundingType::FLOOR);
auto f = std::make_shared<ngraph::Function>(ngraph::NodeVector{pool}, ngraph::ParameterVector{input});
pass::Manager manager;
manager.register_pass<ngraph::pass::Reshape1DOps>();
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<ngraph::op::ConvolutionIE>(input, w, b, strides, dilations, pads_begin, pads_end, 1);
auto f = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv}, ngraph::ParameterVector{});
pass::Manager manager;
manager.register_pass<ngraph::pass::Reshape1DOps>();
ASSERT_NO_THROW(manager.run_passes(f));
}
}

View File

@ -150,6 +150,36 @@ const std::map<ActivationTypes, std::vector<std::vector<float>>> activationTypes
{GeluTanh, {{}}} {GeluTanh, {{}}}
}; };
std::vector<Precision> netPrc = {
Precision::BF16,
Precision::FP32
};
/* ============= Activation (1D) ============= */
std::vector<CPUSpecificParams> cpuParams_3D = {
CPUSpecificParams({nCw16c}, {nCw16c}, {}, {}),
CPUSpecificParams({nwc}, {nwc}, {}, {}),
CPUSpecificParams({ncw}, {ncw}, {}, {})
};
std::vector<std::vector<ov::Shape>> 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<CPUSpecificParams> cpuParams_4D = { std::vector<CPUSpecificParams> cpuParams_4D = {
CPUSpecificParams({nChw16c}, {nChw16c}, {}, {}), CPUSpecificParams({nChw16c}, {nChw16c}, {}, {}),
CPUSpecificParams({nhwc}, {nhwc}, {}, {}), CPUSpecificParams({nhwc}, {nhwc}, {}, {}),
@ -161,10 +191,6 @@ std::vector<std::vector<ov::Shape>> basic4D = {
{{2, 17, 5, 4}} {{2, 17, 5, 4}}
}; };
std::vector<Precision> netPrc = {
Precision::BF16,
Precision::FP32
};
const auto basicCases4D = ::testing::Combine( const auto basicCases4D = ::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(basic4D)), ::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); INSTANTIATE_TEST_SUITE_P(smoke_Activation4D_Eltwise_CPU_BF16, ActivationLayerCPUTest, basicCases4D, ActivationLayerCPUTest::getTestCaseName);
/* ============= Activation (3D) ============= */
std::vector<CPUSpecificParams> cpuParams_5D = { std::vector<CPUSpecificParams> cpuParams_5D = {
CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {}), CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {}),
CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}), CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}),

View File

@ -155,6 +155,8 @@ protected:
PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16]) { PluginConfigParams::YES == configuration[PluginConfigParams::KEY_ENFORCE_BF16]) {
selectedType += "_BF16"; selectedType += "_BF16";
rel_threshold = 1e-2f; rel_threshold = 1e-2f;
if (selectedType == "jit_gemm_BF16")
rel_threshold = 0.05f;
} else { } else {
selectedType = makeSelectedTypeStr(selectedType, netType); 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, // 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). // 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 inpChannels = function->get_parameters().front()->get_partial_shape()[1].get_length();
auto outChannels = function->get_output_partial_shape(0)[1].get_length(); auto outChannels = function->get_output_partial_shape(0)[1].get_length();
if ((inpChannels % 8) || (outChannels % 8)) { if ((inpChannels % 8) || (outChannels % 8)) {
@ -229,11 +231,67 @@ const std::vector<fusingSpecificParams> fusingParamsSetBF16{
}; };
/* ============= Convolution params (GEMM layout) ============= */ /* ============= Convolution params (GEMM layout) ============= */
const SizeVector numOutChannels_Gemm = {6 }; const SizeVector numOutChannels_Gemm = { 6 };
/* ============= Convolution params (blocked and nspc layout) ============= */ /* ============= Convolution params (blocked and nspc layout) ============= */
const SizeVector numOutChannels = { 64, 63 }; const SizeVector numOutChannels = { 64, 63 };
/* ============= Convolution params (1D) ============= */
const std::vector<SizeVector> kernels1d = { {3}, {1} };
const std::vector<SizeVector> strides1d = { {1}, {2} };
const std::vector<std::vector<ptrdiff_t>> padBegins1d = { {0}, {1} };
const std::vector<std::vector<ptrdiff_t>> padEnds1d = { {0} };
const std::vector<SizeVector> dilations1d = { {1}, {2} };
std::vector<InputShape> 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<InputShape> 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) ============= */ /* ============= Convolution params (2D) ============= */
const std::vector<SizeVector> kernels2d = { {3, 3}, {1, 1} }; const std::vector<SizeVector> kernels2d = { {3, 3}, {1, 1} };
const std::vector<SizeVector> strides2d = { {1, 1}, {2, 2} }; const std::vector<SizeVector> strides2d = { {1, 1}, {2, 2} };
@ -332,6 +390,76 @@ std::vector<InputShape> inputShapesPlain2Blocked3d = {
/* ============= */ /* ============= */
/* INSTANCES */ /* 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<CPUSpecificParams> CPUParams_GEMM_1D = {
conv_gemm_1D,
conv_gemm_1D_nspc
};
std::vector<InputShape> 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) ============= */ /* ============= Convolution (Gemm 2D) ============= */
const auto convParams_ExplicitPadding_GEMM_2D = ::testing::Combine( const auto convParams_ExplicitPadding_GEMM_2D = ::testing::Combine(
::testing::ValuesIn(kernels2d), ::testing::ValuesIn(kernels2d),
@ -576,6 +704,102 @@ INSTANTIATE_TEST_SUITE_P(Conv_3D_GEMM_I8_dilated, ConvolutionLayerCPUTest,
::testing::Values(cpuEmptyPluginConfig)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); 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<CPUSpecificParams> 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<CPUSpecificParams> 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) ============= */ /* ============= Convolution (2D) ============= */
const auto convParams_ExplicitPadding_2D = ::testing::Combine( const auto convParams_ExplicitPadding_2D = ::testing::Combine(
::testing::ValuesIn(kernels2d), ::testing::ValuesIn(kernels2d),
@ -696,7 +920,7 @@ const std::vector<CPUSpecificParams> CPUParams_2D_plain_to_blocked = {
conv_avx512_plain_to_blocked_2D, 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(
::testing::Combine( ::testing::Combine(
convParams_ExplicitPadding_2D, convParams_ExplicitPadding_2D,
@ -710,7 +934,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_2D_FP32, ConvolutionLayerCPUT
::testing::Values(cpuEmptyPluginConfig)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); 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(
::testing::Combine( ::testing::Combine(
convParams_ExplicitPadding_2D, convParams_ExplicitPadding_2D,
@ -870,7 +1094,7 @@ const std::vector<CPUSpecificParams> CPUParams_3D_plain_to_blocked = {
conv_avx512_plain_to_blocked_3D, 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(
::testing::Combine( ::testing::Combine(
convParams_ExplicitPadding_3D, convParams_ExplicitPadding_3D,
@ -884,7 +1108,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_PlainToBlocked_3D_FP32, ConvolutionLayerCPUT
::testing::Values(cpuEmptyPluginConfig)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); 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(
::testing::Combine( ::testing::Combine(
convParams_ExplicitPadding_3D, convParams_ExplicitPadding_3D,
@ -926,6 +1150,69 @@ INSTANTIATE_TEST_SUITE_P(Conv_PlainToBlocked_3D_BF16_dilated, ConvolutionLayerCP
::testing::Values(cpuEmptyPluginConfig)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); 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<ptrdiff_t>({0})),
::testing::Values(std::vector<ptrdiff_t>({0})),
::testing::Values(SizeVector({1})),
::testing::Values(63),
::testing::Values(ngraph::op::PadType::EXPLICIT)
);
const std::vector<CPUSpecificParams> 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) ============= */ /* ============= Kernel_1x1 (2D) ============= */
const auto convParams_ExplicitPadding_1x1_2D = ::testing::Combine( 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)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); ConvolutionLayerCPUTest::getTestCaseName);
/* ============= Convolution (1D) ============= */
/* ============= Convolution params (1D) ============= */
const std::vector<SizeVector> kernels1d = { {3} };
const std::vector<SizeVector> strides1d = { {1}, {2} };
const std::vector<std::vector<ptrdiff_t>> padBegins1d = { {0}, {1} };
const std::vector<std::vector<ptrdiff_t>> padEnds1d = { {0} };
const std::vector<SizeVector> 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<CPUSpecificParams> CPUParams_1D = {
conv_sse42_1D,
conv_avx2_1D,
conv_avx512_1D
};
std::vector<InputShape> 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 ============= */ /* ============= Jit Planar ============= */
/* ============= Convolution planar params (2D) ============= */ /* ============= Convolution planar params (2D) ============= */
@ -1068,7 +1305,7 @@ const auto convParams_Planar_ExplicitPadding_2D_dilated = ::testing::Combine(
::testing::Values(ngraph::op::PadType::EXPLICIT) ::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(
::testing::Combine( ::testing::Combine(
convParams_Planar_ExplicitPadding_2D, convParams_Planar_ExplicitPadding_2D,
@ -1082,7 +1319,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_Jit_Planar_2D_FP32, ConvolutionLayerCPUTest,
::testing::Values(cpuEmptyPluginConfig)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); 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(
::testing::Combine( ::testing::Combine(
convParams_Planar_ExplicitPadding_2D_dilated, convParams_Planar_ExplicitPadding_2D_dilated,
@ -1123,7 +1360,7 @@ const auto convParams_Planar_ExplicitPadding_3D_dilated = ::testing::Combine(
::testing::Values(ngraph::op::PadType::EXPLICIT) ::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(
::testing::Combine( ::testing::Combine(
convParams_Planar_ExplicitPadding_3D, convParams_Planar_ExplicitPadding_3D,
@ -1137,7 +1374,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_Jit_Planar_3D_FP32, ConvolutionLayerCPUTest,
::testing::Values(cpuEmptyPluginConfig)), ::testing::Values(cpuEmptyPluginConfig)),
ConvolutionLayerCPUTest::getTestCaseName); 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(
::testing::Combine( ::testing::Combine(
convParams_Planar_ExplicitPadding_3D_dilated, convParams_Planar_ExplicitPadding_3D_dilated,

View File

@ -521,4 +521,4 @@
//INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_5D_dyn_param, EltwiseLayerCPUTest::getTestCaseName); //INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_5D_dyn_param, EltwiseLayerCPUTest::getTestCaseName);
// //
//} // namespace //} // namespace
//} // namespace CPULayerTestsDefinitions //} // namespace CPULayerTestsDefinitions

View File

@ -253,6 +253,13 @@ const SizeVector numGroups_Blocked = {2, 4};
const SizeVector numOutChannels_DW = {32}; const SizeVector numOutChannels_DW = {32};
const SizeVector numGroups_DW = {32}; const SizeVector numGroups_DW = {32};
/* ============= GroupConvolution params (1D) ============= */
const std::vector<SizeVector> kernels1d = { {3}, {1} };
const std::vector<SizeVector> strides1d = { {1}, {2} };
const std::vector<std::vector<ptrdiff_t>> padBegins1d = { {0}, {1} };
const std::vector<std::vector<ptrdiff_t>> padEnds1d = { {0} };
const std::vector<SizeVector> dilations1d = { {1}, {2} };
/* ============= GroupConvolution params (2D) ============= */ /* ============= GroupConvolution params (2D) ============= */
const std::vector<SizeVector> kernels2d = {{3, 3}, {1, 1}}; const std::vector<SizeVector> kernels2d = {{3, 3}, {1, 1}};
const std::vector<SizeVector> strides2d = {{1, 1}, {2, 2}}; const std::vector<SizeVector> strides2d = {{1, 1}, {2, 2}};
@ -270,6 +277,63 @@ const std::vector<SizeVector> dilations3d = {{1, 1, 1}, {2, 2, 2}};
/* INSTANCES */ /* 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<CPUSpecificParams> CPUParams_Gemm_1D = {
conv_gemm_1D,
conv_gemm_1D_nspc
};
std::vector<InputShape> 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) ============= */ /* ============= GroupConvolution (GEMM 2D) ============= */
const auto groupConvParams_ExplicitPadding_Gemm_2D = ::testing::Combine( const auto groupConvParams_ExplicitPadding_Gemm_2D = ::testing::Combine(
::testing::ValuesIn(kernels2d), ::testing::ValuesIn(kernels2d),
@ -384,6 +448,89 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_3D_Gemm_BF16, GroupConvolutionLayerCPUT
::testing::Values(cpuBF16PluginConfig)), ::testing::Values(cpuBF16PluginConfig)),
GroupConvolutionLayerCPUTest::getTestCaseName); 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<CPUSpecificParams> 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<InputShape> 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) ============= */ /* ============= GroupConvolution (2D) ============= */
const auto groupConvParams_ExplicitPadding_2D = ::testing::Combine( const auto groupConvParams_ExplicitPadding_2D = ::testing::Combine(
::testing::ValuesIn(kernels2d), ::testing::ValuesIn(kernels2d),
@ -505,6 +652,71 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConv_3D_BF16, GroupConvolutionLayerCPUTest,
::testing::Values(cpuBF16PluginConfig)), ::testing::Values(cpuBF16PluginConfig)),
GroupConvolutionLayerCPUTest::getTestCaseName); 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<CPUSpecificParams> 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<InputShape> 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) ============= */ /* ============= GroupConvolution (DW 2D) ============= */
const auto groupConvParams_ExplicitPadding_DW_2D = ::testing::Combine( const auto groupConvParams_ExplicitPadding_DW_2D = ::testing::Combine(
::testing::ValuesIn(kernels2d), ::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) ============= */ /* ============= JIT AVX5122 PLANAR Convolution (not supported with groups) ============= */
/* ============================================= */ /* ============================================= */
/* ============= Convolution (1D) ============= */
/* ============= Convolution params (1D) ============= */
const std::vector<SizeVector> kernels1d = { {3} };
const std::vector<SizeVector> strides1d = { {1}, {2} };
const std::vector<std::vector<ptrdiff_t>> padBegins1d = { {0}, {1} };
const std::vector<std::vector<ptrdiff_t>> padEnds1d = { {0} };
const std::vector<SizeVector> 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<CPUSpecificParams> CPUParams_1D = {
conv_sse42_1D,
conv_avx2_1D,
conv_avx512_1D
};
std::vector<InputShape> 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
} // namespace CPULayerTestsDefinitions } // namespace CPULayerTestsDefinitions

View File

@ -141,6 +141,34 @@ const auto ref = CPUSpecificParams{{}, {}, {"ref_any"}, "ref_any"};
const std::vector<CPUSpecificParams> vecCpuConfigs = {ref, sse42, avx, avx512}; const std::vector<CPUSpecificParams> vecCpuConfigs = {ref, sse42, avx, avx512};
const std::vector<ElementType> inpOutPrecision = {ElementType::f32/*, ElementType::bf16*/}; const std::vector<ElementType> inpOutPrecision = {ElementType::f32/*, ElementType::bf16*/};
const std::vector<InputShape> 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<InputShape> inputShapes4D = { const std::vector<InputShape> inputShapes4D = {
{ {}, {{3, 4, 64, 64}} }, { {}, {{3, 4, 64, 64}} },
{ {}, {{2, 8, 8, 12}} }, { {}, {{2, 8, 8, 12}} },
@ -197,6 +225,61 @@ const std::vector<InputShape> inputShapes5D = {
} }
}; };
/* ============= Pooling (1D) ============= */
const std::vector<LayerTestsDefinitions::poolSpecificParams> 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<LayerTestsDefinitions::poolSpecificParams> 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<LayerTestsDefinitions::poolSpecificParams> 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<LayerTestsDefinitions::poolSpecificParams> paramsMax4D = { const std::vector<LayerTestsDefinitions::poolSpecificParams> paramsMax4D = {
LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2, 2}, {2, 2}, {0, 0}, {0, 0}, LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2, 2}, {2, 2}, {0, 0}, {0, 0},
ngraph::op::RoundingType::CEIL, ngraph::op::PadType::SAME_LOWER, false }, 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)), ::testing::Values(emptyFusingSpec)),
PoolingLayerCPUTest::getTestCaseName); PoolingLayerCPUTest::getTestCaseName);
/* ============= Pooling (3D) ============= */
const std::vector<LayerTestsDefinitions::poolSpecificParams> paramsMax5D = { const std::vector<LayerTestsDefinitions::poolSpecificParams> paramsMax5D = {
LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2, 2, 2}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}, 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 }, ngraph::op::RoundingType::CEIL, ngraph::op::PadType::SAME_LOWER, false },

View File

@ -7,62 +7,86 @@
#include "cpu_test_utils.hpp" #include "cpu_test_utils.hpp"
namespace CPUTestUtils { namespace CPUTestUtils {
const auto conv_sse42_1D = CPUSpecificParams{{}, {}, {"jit_sse42"}, "jit_sse42"}; const auto conv_ref_1D = CPUSpecificParams{{ncw}, {ncw}, {"ref_any"}, "ref_any"};
const auto conv_avx2_1D = CPUSpecificParams{{}, {}, {"jit_avx2"}, "jit_avx2"};
const auto conv_avx512_1D = CPUSpecificParams{{}, {}, {"jit_avx512"}, "jit_avx512"};
const auto conv_ref_2D = CPUSpecificParams{{nchw}, {nchw}, {"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_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_2D = CPUSpecificParams{{nchw}, {nchw}, {"gemm_any"}, "jit_gemm"};
const auto conv_gemm_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"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_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_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_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42"}, "jit_sse42"};
const auto conv_sse42_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"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_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_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_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_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_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_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_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_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_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_avx2"}, "jit_avx2"};
const auto conv_avx2_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"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_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_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_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_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_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_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_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_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_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_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_2D = CPUSpecificParams{{nChw16c}, {nChw16c}, {"jit_avx512"}, "jit_avx512"};
const auto conv_avx512_3D = CPUSpecificParams{{nCdhw16c}, {nCdhw16c}, {"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_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_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_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_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_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_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_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_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_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_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_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_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"}; const auto conv_avx512_2D_1x1 = CPUSpecificParams{{nChw16c}, {nChw16c}, {"jit_avx512_1x1"}, "jit_avx512_1x1"};

View File

@ -308,6 +308,8 @@ std::string CPUTestsBase::makeSelectedTypeStr(std::string implString, ngraph::el
std::vector<CPUSpecificParams> filterCPUSpecificParams(std::vector<CPUSpecificParams> &paramsVector) { std::vector<CPUSpecificParams> filterCPUSpecificParams(std::vector<CPUSpecificParams> &paramsVector) {
auto adjustBlockedFormatByIsa = [](std::vector<cpu_memory_format_t>& formats) { auto adjustBlockedFormatByIsa = [](std::vector<cpu_memory_format_t>& formats) {
for (int i = 0; i < formats.size(); i++) { for (int i = 0; i < formats.size(); i++) {
if (formats[i] == nCw16c)
formats[i] = nCw8c;
if (formats[i] == nChw16c) if (formats[i] == nChw16c)
formats[i] = nChw8c; formats[i] = nChw8c;
if (formats[i] == nCdhw16c) if (formats[i] == nCdhw16c)

View File

@ -1,516 +0,0 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <string>
#include <memory>
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset1.hpp>
#include <ngraph_transformations/reshape_1d_ops.hpp>
#include <transformations/init_node_info.hpp>
#include <transformations/utils/utils.hpp>
#include <ngraph_ops/type_relaxed.hpp>
#include <ngraph/pass/manager.hpp>
#include "common_test_utils/ngraph_test_utils.hpp"
using namespace testing;
using namespace MKLDNNPlugin;
TEST(TransformationTests, Reshape1DAvgPoolTest1) {
std::shared_ptr<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 });
auto avgPool = std::make_shared<ngraph::opset1::AvgPool>(
input,
ngraph::Strides{ 1 },
ngraph::Shape{ 1 },
ngraph::Shape{ 0 },
ngraph::Shape{ 2 },
true);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ avgPool }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DAvgPool>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Unsqueeze>(input, unsqueeze_const);
auto avg_pool = std::make_shared<ngraph::opset1::AvgPool>(
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<ngraph::opset1::Squeeze>(avg_pool, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic(3));
auto avgPool = std::make_shared<ngraph::opset1::AvgPool>(
input,
ngraph::Strides{ 1 },
ngraph::Shape{ 1 },
ngraph::Shape{ 0 },
ngraph::Shape{ 2 },
true);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ avgPool }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DAvgPool>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic(3));
auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 });
auto unsqueeze = std::make_shared<ngraph::opset1::Unsqueeze>(input, unsqueeze_const);
auto avg_pool = std::make_shared<ngraph::opset1::AvgPool>(
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<ngraph::opset1::Squeeze>(avg_pool, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 1, 3, 16, 16 });
auto avgPool = std::make_shared<ngraph::opset1::AvgPool>(
input,
ngraph::Strides{ 1, 1 },
ngraph::Shape{ 1, 1 },
ngraph::Shape{ 0, 0 },
ngraph::Shape{ 2, 2 },
true);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ avgPool }, ngraph::ParameterVector{ input });
f_ref = f;
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DAvgPool>();
m.run_passes(f);
}
auto res = compare_functions(f, f_ref);
ASSERT_TRUE(res.first) << res.second;
}
TEST(TransformationTests, Reshape1DMaxPoolTest1) {
std::shared_ptr<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 1, 3, 16 });
auto max_pool = std::make_shared<ngraph::opset1::MaxPool>(
input,
ngraph::Strides{ 1 },
ngraph::Shape{ 1 },
ngraph::Shape{ 0 },
ngraph::Shape{ 2 });
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ max_pool }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DMaxPool>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Unsqueeze>(input, unsqueeze_const);
auto max_pool = std::make_shared<ngraph::opset1::MaxPool>(
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<ngraph::opset1::Squeeze>(max_pool, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic(3));
auto max_pool = std::make_shared<ngraph::opset1::MaxPool>(
input,
ngraph::Strides{ 1 },
ngraph::Shape{ 1 },
ngraph::Shape{ 0 },
ngraph::Shape{ 2 });
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ max_pool }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DMaxPool>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic(3));
auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 });
auto unsqueeze = std::make_shared<ngraph::opset1::Unsqueeze>(input, unsqueeze_const);
auto max_pool = std::make_shared<ngraph::opset1::MaxPool>(
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<ngraph::opset1::Squeeze>(max_pool, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic());
auto max_pool = std::make_shared<ngraph::opset1::MaxPool>(
input,
ngraph::Strides{ 1 },
ngraph::Shape{ 1 },
ngraph::Shape{ 0 },
ngraph::Shape{ 2 });
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ max_pool }, ngraph::ParameterVector{ input });
f_ref = f;
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DMaxPool>();
m.run_passes(f);
}
auto res = compare_functions(f, f_ref);
ASSERT_TRUE(res.first) << res.second;
}
TEST(TransformationTests, Reshape1DConvolutionTest1) {
std::shared_ptr<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Convolution>(
input,
weights,
ngraph::Strides{ 1 },
ngraph::CoordinateDiff{ 0 },
ngraph::CoordinateDiff{ 0 },
ngraph::Strides{ 1 });
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ convolution }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DConvolution>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Unsqueeze>(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<ngraph::opset1::Convolution>(
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<ngraph::opset1::Squeeze>(convolution, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Convolution>(
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<ngraph::opset1::Add>(convolution, bias_const);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ bias }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DConvolution>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Unsqueeze>(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<ngraph::opset1::Convolution>(
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<ngraph::opset1::Add>(convolution, bias_const);
auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 });
auto squeeze = std::make_shared<ngraph::opset1::Squeeze>(bias, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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::op::TypeRelaxed<ngraph::opset1::Convolution>>(
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::Function>(ngraph::NodeVector{ relaxed_convolution }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DConvolution>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Unsqueeze>(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::op::TypeRelaxed<ngraph::opset1::Convolution>>(
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<ngraph::opset1::Squeeze>(relaxed_convolution, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Convolution>(
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<ngraph::opset1::Add>(convolution, bias_const);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ bias }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DConvolution>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic(3));
auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 });
auto unsqueeze = std::make_shared<ngraph::opset1::Unsqueeze>(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<ngraph::opset1::Convolution>(
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<ngraph::opset1::Add>(convolution, bias_const);
auto squeeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 });
auto squeeze = std::make_shared<ngraph::opset1::Squeeze>(bias, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::GroupConvolution>(
input,
weights,
ngraph::Strides{ 1 },
ngraph::CoordinateDiff{ 0 },
ngraph::CoordinateDiff{ 0 },
ngraph::Strides{ 1 });
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ group_convolution }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DGroupConvolution>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::Unsqueeze>(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<ngraph::opset1::GroupConvolution>(
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<ngraph::opset1::Squeeze>(group_convolution, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(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<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto input = std::make_shared<ngraph::opset1::Parameter>(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<ngraph::opset1::GroupConvolution>(
input,
weights,
ngraph::Strides{ 1 },
ngraph::CoordinateDiff{ 0 },
ngraph::CoordinateDiff{ 0 },
ngraph::Strides{ 1 });
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ group_convolution }, ngraph::ParameterVector{ input });
ngraph::pass::Manager m;
m.register_pass<ngraph::pass::InitNodeInfo>();
m.register_pass<Reshape1DGroupConvolution>();
m.run_passes(f);
}
{
auto input = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::PartialShape::dynamic(3));
auto unsqueeze_const = ngraph::opset1::Constant::create(ngraph::element::i32, { 1 }, { 2 });
auto unsqueeze = std::make_shared<ngraph::opset1::Unsqueeze>(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<ngraph::opset1::GroupConvolution>(
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<ngraph::opset1::Squeeze>(group_convolution, squeeze_const);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{ squeeze }, ngraph::ParameterVector{ input });
}
auto res = compare_functions(f, f_ref);
ASSERT_TRUE(res.first) << res.second;
}

@ -1 +1 @@
Subproject commit deab85766ff3fb547ae34eeff94fca4e73bd3053 Subproject commit d5d0552538a0962bd83161ca060220c82f8c4b49

View File

@ -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_63137 = xfail_test(reason="Unsupported operations: OptionalHasElement, OptionalGetElement")
xfail_issue_63138 = xfail_test(reason="Missing ONNX Shape-15 support") 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_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") xfail_issue_68212 = xfail_test(reason="Unsupported reading model with bytes streams")

View File

@ -10,7 +10,6 @@ from openvino.runtime.impl import AxisSet, Function, Shape, Type
from openvino.runtime.impl.op import Constant, Parameter from openvino.runtime.impl.op import Constant, Parameter
from tests.runtime import get_runtime from tests.runtime import get_runtime
from tests import xfail_issue_54663
def binary_op(op_str, a, b): def binary_op(op_str, a, b):
@ -542,7 +541,6 @@ def test_select():
expected = np.array([[5, 8]]) expected = np.array([[5, 8]])
assert np.allclose(result, expected) assert np.allclose(result, expected)
@xfail_issue_54663
def test_max_pool(): def test_max_pool():
# test 1d # test 1d
element_type = Type.f32 element_type = Type.f32

View File

@ -543,7 +543,6 @@ def test_select():
assert np.allclose(result, expected) assert np.allclose(result, expected)
@xfail_issue_54663
def test_max_pool(): def test_max_pool():
# test 1d # test 1d
element_type = Type.f32 element_type = Type.f32