[CPU] Pooling & FakeQuantize cache (#9503)
* [CPUCache]Impl FakeQuantize * [CPUCache]Impl Pooling * [CPUCache]Fix Pooling == * [CpuCache]apply review comments * [CpuCache]fix pooling ==
This commit is contained in:
parent
5b40f381cb
commit
6d3f99c7db
@ -23,6 +23,7 @@
|
|||||||
#include "memory_desc/dnnl_blocked_memory_desc.h"
|
#include "memory_desc/dnnl_blocked_memory_desc.h"
|
||||||
#include "utils/ngraph_utils.hpp"
|
#include "utils/ngraph_utils.hpp"
|
||||||
#include "common/cpu_memcpy.h"
|
#include "common/cpu_memcpy.h"
|
||||||
|
#include <common/primitive_hashing_utils.hpp>
|
||||||
|
|
||||||
// Quantization ranges validation is switched off by default in order to avoid regressions on user side
|
// Quantization ranges validation is switched off by default in order to avoid regressions on user side
|
||||||
// #define VALIDATE_QUANTIZATION_RANGES
|
// #define VALIDATE_QUANTIZATION_RANGES
|
||||||
@ -885,6 +886,31 @@ bool MKLDNNFakeQuantizeNode::isSupportedOperation(const std::shared_ptr<const ng
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct FakeQuantKey {
|
||||||
|
jit_quantize_params jqp;
|
||||||
|
size_t hash() const {
|
||||||
|
size_t seed = 0;
|
||||||
|
seed = hash_combine(seed, jqp.c);
|
||||||
|
seed = hash_combine(seed, jqp.is_planar);
|
||||||
|
seed = hash_combine(seed, jqp.src_prc.getPrecVal());
|
||||||
|
seed = hash_combine(seed, jqp.wei_prc.getPrecVal());
|
||||||
|
seed = hash_combine(seed, jqp.dst_prc.getPrecVal());
|
||||||
|
seed = dnnl::impl::primitive_hashing::get_vector_hash(seed, jqp.s_str);
|
||||||
|
seed = dnnl::impl::primitive_hashing::get_vector_hash(seed, jqp.d_str);
|
||||||
|
seed = hash_combine(seed, jqp.op_type);
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const FakeQuantKey& rhs) const {
|
||||||
|
bool result = jqp.c == rhs.jqp.c && jqp.is_planar == rhs.jqp.is_planar && jqp.src_prc == rhs.jqp.src_prc &&
|
||||||
|
jqp.wei_prc == rhs.jqp.wei_prc && jqp.dst_prc == rhs.jqp.dst_prc &&
|
||||||
|
jqp.op_type == rhs.jqp.op_type && jqp.s_str == rhs.jqp.s_str && jqp.d_str == rhs.jqp.d_str;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
MKLDNNFakeQuantizeNode::MKLDNNFakeQuantizeNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) :
|
MKLDNNFakeQuantizeNode::MKLDNNFakeQuantizeNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) :
|
||||||
MKLDNNNode(op, eng, cache) {
|
MKLDNNNode(op, eng, cache) {
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
@ -1363,27 +1389,28 @@ void MKLDNNFakeQuantizeNode::prepareParams() {
|
|||||||
IE_THROW() << "CPU quantize node with name '" << getName() << "' doesn't have primitive descriptors.";
|
IE_THROW() << "CPU quantize node with name '" << getName() << "' doesn't have primitive descriptors.";
|
||||||
if (selectedPrimitiveDescriptor->getImplementationType() != impl_desc_type::ref) {
|
if (selectedPrimitiveDescriptor->getImplementationType() != impl_desc_type::ref) {
|
||||||
const auto& config = getSelectedPrimitiveDescriptor()->getConfig();
|
const auto& config = getSelectedPrimitiveDescriptor()->getConfig();
|
||||||
|
|
||||||
const auto& inDims = getParentEdgesAtPort(0)[0]->getMemory().getStaticDims();
|
const auto& inDims = getParentEdgesAtPort(0)[0]->getMemory().getStaticDims();
|
||||||
|
//Form FakeQuanKey
|
||||||
jit_quantize_params jqp = {};
|
FakeQuantKey key = {};
|
||||||
jqp.c = inDims.size() > 1 ? inDims[1] : 1;
|
key.jqp.c = inDims.size() > 1 ? inDims[1] : 1;
|
||||||
|
key.jqp.src_prc = config.inConfs[0].desc->getPrecision();
|
||||||
jqp.src_prc = config.inConfs[0].desc->getPrecision();
|
key.jqp.wei_prc = Precision::FP32;
|
||||||
jqp.wei_prc = Precision::FP32;
|
key.jqp.dst_prc = config.outConfs[0].desc->getPrecision();
|
||||||
jqp.dst_prc = config.outConfs[0].desc->getPrecision();
|
|
||||||
|
|
||||||
auto srcDesc = getParentEdgeAt(0)->getMemory().GetDescWithType<BlockedMemoryDesc>();
|
auto srcDesc = getParentEdgeAt(0)->getMemory().GetDescWithType<BlockedMemoryDesc>();
|
||||||
jqp.s_str = srcDesc->getStrides();
|
key.jqp.s_str = srcDesc->getStrides();
|
||||||
|
|
||||||
auto dstDesc = getChildEdgeAt(0)->getMemory().GetDescWithType<BlockedMemoryDesc>();
|
auto dstDesc = getChildEdgeAt(0)->getMemory().GetDescWithType<BlockedMemoryDesc>();
|
||||||
jqp.d_str = dstDesc->getStrides();
|
|
||||||
|
|
||||||
jqp.is_planar = srcDesc->hasLayoutType(LayoutType::ncsp) && one_of(srcDesc->getShape().getRank(), 3, 4, 5);
|
key.jqp.d_str = dstDesc->getStrides();
|
||||||
|
key.jqp.is_planar = srcDesc->hasLayoutType(LayoutType::ncsp) && one_of(srcDesc->getShape().getRank(), 3, 4, 5);
|
||||||
|
key.jqp.op_type = getAlgorithm();
|
||||||
|
|
||||||
jqp.op_type = getAlgorithm();
|
auto cache = getRuntimeCache();
|
||||||
|
auto buildExecutor = [](const FakeQuantKey& key) {
|
||||||
execPtr = std::make_shared<FakeQuantizeJitExecutor>(jqp);
|
return std::make_shared<FakeQuantizeJitExecutor>(key.jqp);
|
||||||
|
};
|
||||||
|
auto result = cache->getOrCreate(key, buildExecutor);
|
||||||
|
execPtr = result.first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,111 @@
|
|||||||
#include <utils/general_utils.h>
|
#include <utils/general_utils.h>
|
||||||
#include <memory_desc/cpu_memory_desc_utils.h>
|
#include <memory_desc/cpu_memory_desc_utils.h>
|
||||||
#include "memory_desc/dnnl_blocked_memory_desc.h"
|
#include "memory_desc/dnnl_blocked_memory_desc.h"
|
||||||
|
#include <common/primitive_hashing_utils.hpp>
|
||||||
|
|
||||||
using namespace mkldnn;
|
using namespace mkldnn;
|
||||||
using namespace MKLDNNPlugin;
|
using namespace MKLDNNPlugin;
|
||||||
using namespace InferenceEngine;
|
using namespace InferenceEngine;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct PoolingKey {
|
||||||
|
DnnlMemoryDescCPtr inp;
|
||||||
|
DnnlMemoryDescCPtr out;
|
||||||
|
std::vector<ptrdiff_t> stride;
|
||||||
|
std::vector<ptrdiff_t> kernel;
|
||||||
|
/// Effective padding. Used to define correct output shape by MKLDNN
|
||||||
|
/// reshape formula: (iw - kernel + pad_l + pad_r) / strides[i - 2] + 1
|
||||||
|
/// should be passed into pooling desc constructor.
|
||||||
|
std::vector<ptrdiff_t> effective_pad_begin;
|
||||||
|
std::vector<ptrdiff_t> effective_pad_end;
|
||||||
|
/// Effective dilation. Used to define correct dilation for OneDNN.
|
||||||
|
/// For OneDNN default dilation is vector of zero
|
||||||
|
std::vector<ptrdiff_t> effective_dilation;
|
||||||
|
std::vector<ptrdiff_t> data_pad_end;
|
||||||
|
mkldnn::primitive_attr attr;
|
||||||
|
algorithm alg;
|
||||||
|
impl_desc_type implType;
|
||||||
|
|
||||||
|
size_t hash() const {
|
||||||
|
using namespace dnnl::impl;
|
||||||
|
using namespace dnnl::impl::primitive_hashing;
|
||||||
|
size_t seed = 0;
|
||||||
|
seed = hash_combine(seed, get_md_hash(inp->getDnnlDesc().data));
|
||||||
|
seed = get_vector_hash(seed, stride);
|
||||||
|
seed = get_vector_hash(seed, kernel);
|
||||||
|
seed = get_vector_hash(seed, effective_pad_begin);
|
||||||
|
seed = get_vector_hash(seed, effective_pad_end);
|
||||||
|
seed = get_vector_hash(seed, effective_dilation);
|
||||||
|
seed = get_vector_hash(seed, data_pad_end);
|
||||||
|
seed = hash_combine(seed, get_md_hash(out->getDnnlDesc().data));
|
||||||
|
seed = hash_combine(seed, get_attr_hash(*attr.get()));
|
||||||
|
seed = hash_combine(seed, alg);
|
||||||
|
seed = hash_combine(seed, implType);
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const PoolingKey& rhs) const {
|
||||||
|
bool result = true;
|
||||||
|
if (inp != rhs.inp) {
|
||||||
|
result = result && inp && rhs.inp && (inp->getDnnlDesc() == rhs.inp->getDnnlDesc());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out != rhs.out) {
|
||||||
|
result = result && out && rhs.out && (out->getDnnlDesc() == rhs.out->getDnnlDesc());
|
||||||
|
}
|
||||||
|
|
||||||
|
result = result && stride == rhs.stride && kernel == rhs.kernel &&
|
||||||
|
effective_pad_begin == rhs.effective_pad_begin && effective_pad_end == rhs.effective_pad_end &&
|
||||||
|
effective_dilation == rhs.effective_dilation && data_pad_end == rhs.data_pad_end &&
|
||||||
|
*attr.get() == *rhs.attr.get() && alg == rhs.alg && implType == rhs.implType;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<pooling_v2_forward::desc> createDescriptorHelper(const mkldnn::memory::desc& in_candidate,
|
||||||
|
const mkldnn::memory::desc& out_candidate,
|
||||||
|
const mkldnn::algorithm alg,
|
||||||
|
const std::vector<ptrdiff_t>& stride,
|
||||||
|
const std::vector<ptrdiff_t>& kernel,
|
||||||
|
const std::vector<ptrdiff_t>& effective_pad_begin,
|
||||||
|
const std::vector<ptrdiff_t>& effective_pad_end,
|
||||||
|
const std::vector<ptrdiff_t>& effective_dilation,
|
||||||
|
const std::vector<ptrdiff_t>& data_pad_end) {
|
||||||
|
if (alg == mkldnn::algorithm::undef) {
|
||||||
|
IE_THROW() << "Unsupported pooling type";
|
||||||
|
}
|
||||||
|
|
||||||
|
auto convert = [](std::vector<ptrdiff_t> orig_dims) {
|
||||||
|
return memory::dims(orig_dims.begin(), orig_dims.end());
|
||||||
|
};
|
||||||
|
std::shared_ptr<pooling_v2_forward::desc> desc_ptr(new pooling_v2_forward::desc(prop_kind::forward_scoring,
|
||||||
|
alg,
|
||||||
|
in_candidate,
|
||||||
|
out_candidate,
|
||||||
|
convert(stride),
|
||||||
|
convert(kernel),
|
||||||
|
convert(effective_dilation),
|
||||||
|
convert(effective_pad_begin),
|
||||||
|
convert(effective_pad_end)));
|
||||||
|
|
||||||
|
if (alg == mkldnn::algorithm::pooling_avg_include_padding) {
|
||||||
|
// In case of AVG including paddings the norm coeff should be calculated
|
||||||
|
// with tacking into account original pads. So we need to restore
|
||||||
|
// original values for end paddings.
|
||||||
|
//
|
||||||
|
// WA. Because mkldnn uses different formula to calculate AVG norm coeff
|
||||||
|
// in compare with Caffe. In mkldnn coeff is always 1/(KH*KW)
|
||||||
|
for (int i = 0; i < data_pad_end.size(); i++) {
|
||||||
|
if (data_pad_end[i] != effective_pad_end[i])
|
||||||
|
desc_ptr->data.padding[1][i] = static_cast<ptrdiff_t>(data_pad_end[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
bool MKLDNNPoolingNode::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
|
bool MKLDNNPoolingNode::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
|
||||||
try {
|
try {
|
||||||
if (ov::is_type<const ov::op::v8::MaxPool>(op)) {
|
if (ov::is_type<const ov::op::v8::MaxPool>(op)) {
|
||||||
@ -239,9 +339,7 @@ void MKLDNNPoolingNode::prepareParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto inDesc = getParentEdgesAtPort(0)[0]->getMemory().GetDescWithType<DnnlMemoryDesc>();
|
auto inDesc = getParentEdgesAtPort(0)[0]->getMemory().GetDescWithType<DnnlMemoryDesc>();
|
||||||
const auto& in_candidate = inDesc->getDnnlDesc();
|
|
||||||
auto outDesc = getChildEdgesAtPort(0)[0]->getMemory().GetDescWithType<DnnlMemoryDesc>();
|
auto outDesc = getChildEdgesAtPort(0)[0]->getMemory().GetDescWithType<DnnlMemoryDesc>();
|
||||||
const auto& out_candidate = outDesc->getDnnlDesc();
|
|
||||||
|
|
||||||
if (isDynamicNode()) {
|
if (isDynamicNode()) {
|
||||||
if (auto_pad) {
|
if (auto_pad) {
|
||||||
@ -251,22 +349,52 @@ void MKLDNNPoolingNode::prepareParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mkldnn::algorithm alg = getPoolingAlgorithm();
|
mkldnn::algorithm alg = getPoolingAlgorithm();
|
||||||
MKLDNNDescriptor desc{createDescriptorInternal(in_candidate, out_candidate, alg)};
|
PoolingKey key = {inDesc,
|
||||||
pooling_v2_forward::primitive_desc prim_desc;
|
outDesc,
|
||||||
primitive_desc_iterator itpd = desc.createPrimitiveDescriptorIterator(getEngine(), *attr);
|
stride,
|
||||||
|
kernel,
|
||||||
|
effective_pad_begin,
|
||||||
|
effective_pad_end,
|
||||||
|
effective_dilation,
|
||||||
|
data_pad_end,
|
||||||
|
*attr,
|
||||||
|
alg,
|
||||||
|
selected_pd->getImplementationType()};
|
||||||
|
auto engine = getEngine();
|
||||||
|
auto builder = [&engine](const PoolingKey& key) -> std::shared_ptr<mkldnn::primitive> {
|
||||||
|
auto desc_ptr = createDescriptorHelper(key.inp->getDnnlDesc(),
|
||||||
|
key.out->getDnnlDesc(),
|
||||||
|
key.alg,
|
||||||
|
key.stride,
|
||||||
|
key.kernel,
|
||||||
|
key.effective_pad_begin,
|
||||||
|
key.effective_pad_end,
|
||||||
|
key.effective_dilation,
|
||||||
|
key.data_pad_end);
|
||||||
|
MKLDNNDescriptor desc{desc_ptr};
|
||||||
|
pooling_v2_forward::primitive_desc prim_desc;
|
||||||
|
primitive_desc_iterator itpd = desc.createPrimitiveDescriptorIterator(engine, key.attr);
|
||||||
|
while (static_cast<bool>(itpd)) {
|
||||||
|
impl_desc_type impl_type = parse_impl_name(itpd.impl_info_str());
|
||||||
|
|
||||||
while (static_cast<bool>(itpd)) {
|
if (impl_type == key.implType) {
|
||||||
impl_desc_type impl_type = parse_impl_name(itpd.impl_info_str());
|
prim_desc = itpd.get();
|
||||||
|
break;
|
||||||
if (impl_type == selected_pd->getImplementationType()) {
|
}
|
||||||
prim_desc = itpd.get();
|
if (!itpd.next_impl())
|
||||||
break;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!itpd.next_impl())
|
return std::make_shared<pooling_v2_forward>(prim_desc);
|
||||||
IE_THROW() << "Primitive descriptor was not found for node " << getName() << ".";
|
};
|
||||||
|
|
||||||
|
auto cache = getRuntimeCache();
|
||||||
|
auto result = cache->getOrCreate(key, builder);
|
||||||
|
|
||||||
|
if (!result.first) {
|
||||||
|
IE_THROW() << "Primitive descriptor was not found for node " << getName() << ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
prim.reset(new pooling_v2_forward(prim_desc));
|
prim = result.first;
|
||||||
|
|
||||||
auto src = getParentEdgesAtPort(0)[0]->getMemoryPtr()->GetPrimitive();
|
auto src = getParentEdgesAtPort(0)[0]->getMemoryPtr()->GetPrimitive();
|
||||||
auto dst = getChildEdgesAtPort(0)[0]->getMemoryPtr()->GetPrimitive();
|
auto dst = getChildEdgesAtPort(0)[0]->getMemoryPtr()->GetPrimitive();
|
||||||
@ -308,39 +436,19 @@ mkldnn::algorithm MKLDNNPoolingNode::getPoolingAlgorithm() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<pooling_v2_forward::desc> MKLDNNPoolingNode::createDescriptorInternal(const mkldnn::memory::desc& in_candidate,
|
std::shared_ptr<pooling_v2_forward::desc> MKLDNNPoolingNode::createDescriptorInternal(
|
||||||
const mkldnn::memory::desc& out_candidate,
|
const mkldnn::memory::desc& in_candidate,
|
||||||
const mkldnn::algorithm alg) const {
|
const mkldnn::memory::desc& out_candidate,
|
||||||
if (alg == mkldnn::algorithm::undef) {
|
const mkldnn::algorithm alg) const {
|
||||||
IE_THROW() << "Unsupported pooling type";
|
return createDescriptorHelper(in_candidate,
|
||||||
}
|
out_candidate,
|
||||||
|
alg,
|
||||||
auto convert = [] (std::vector<ptrdiff_t> orig_dims) {
|
stride,
|
||||||
return memory::dims(orig_dims.begin(), orig_dims.end());
|
kernel,
|
||||||
};
|
effective_pad_begin,
|
||||||
std::shared_ptr<pooling_v2_forward::desc> desc_ptr(
|
effective_pad_end,
|
||||||
new pooling_v2_forward::desc(prop_kind::forward_scoring, alg,
|
effective_dilation,
|
||||||
in_candidate, out_candidate,
|
data_pad_end);
|
||||||
convert(stride),
|
|
||||||
convert(kernel),
|
|
||||||
convert(effective_dilation),
|
|
||||||
convert(effective_pad_begin),
|
|
||||||
convert(effective_pad_end)));
|
|
||||||
|
|
||||||
if (alg == mkldnn::algorithm::pooling_avg_include_padding) {
|
|
||||||
// In case of AVG including paddings the norm coeff should be calculated
|
|
||||||
// with tacking into account original pads. So we need to restore
|
|
||||||
// original values for end paddings.
|
|
||||||
//
|
|
||||||
// WA. Because mkldnn uses different formula to calculate AVG norm coeff
|
|
||||||
// in compare with Caffe. In mkldnn coeff is always 1/(KH*KW)
|
|
||||||
for (int i = 0; i < data_pad_end.size(); i++) {
|
|
||||||
if (data_pad_end[i] != effective_pad_end[i])
|
|
||||||
desc_ptr->data.padding[1][i] = static_cast<ptrdiff_t>(data_pad_end[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return desc_ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MKLDNNPoolingNode::createDescriptor(const std::vector<MemoryDescPtr> &inputDesc,
|
void MKLDNNPoolingNode::createDescriptor(const std::vector<MemoryDescPtr> &inputDesc,
|
||||||
|
@ -1,427 +1,397 @@
|
|||||||
//// Copyright (C) 2018-2021 Intel Corporation
|
// Copyright (C) 2018-2021 Intel Corporation
|
||||||
//// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
////
|
//
|
||||||
//
|
|
||||||
//#include "shared_test_classes/base/layer_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
//#include "test_utils/cpu_test_utils.hpp"
|
#include "ngraph_functions/builders.hpp"
|
||||||
//#include "ngraph_functions/builders.hpp"
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
//
|
#include <functional_test_utils/ov_tensor_utils.hpp>
|
||||||
//using namespace InferenceEngine;
|
|
||||||
//using namespace ngraph;
|
using namespace InferenceEngine;
|
||||||
//using namespace CPUTestUtils;
|
using namespace ngraph;
|
||||||
//
|
using namespace CPUTestUtils;
|
||||||
//namespace CPULayerTestsDefinitions {
|
using namespace ov::test;
|
||||||
//
|
|
||||||
//using inputShapes = std::tuple<std::vector<ngraph::PartialShape>, // dynamic input shapes
|
namespace CPULayerTestsDefinitions {
|
||||||
// std::vector<ngraph::Shape>, // target input shapes
|
using inputShapes = std::tuple<ov::test::InputShape, // dynamic data shape
|
||||||
// std::vector<SizeVector>>; // range input shapes
|
std::vector<SizeVector>>; // range input shapes
|
||||||
//
|
|
||||||
//using fqSpecificParams = std::tuple<int64_t, // 'data' input low bounds
|
using fqSpecificParams = std::tuple<int64_t, // 'data' input low bounds
|
||||||
// int64_t, // 'data' input high bounds
|
int64_t, // 'data' input high bounds
|
||||||
// std::vector<float>, // output low
|
std::vector<float>, // output low
|
||||||
// std::vector<float>, // output high
|
std::vector<float>, // output high
|
||||||
// size_t>; // levels
|
size_t>; // levels
|
||||||
//
|
|
||||||
//using fqLayerTestParamsSet = std::tuple<fqSpecificParams,
|
using fqLayerTestParamsSet = std::tuple<fqSpecificParams,
|
||||||
// inputShapes, // input shapes
|
inputShapes, // input shapes
|
||||||
// Precision, // input precision
|
Precision, // input precision
|
||||||
// std::pair<std::vector<float>, std::vector<float>>, // il and ih values
|
std::pair<std::vector<float>, std::vector<float>>, // il and ih values
|
||||||
// bool, // should be decomposed
|
bool, // should be decomposed
|
||||||
// CPUSpecificParams>;
|
CPUSpecificParams>;
|
||||||
//
|
|
||||||
//class FakeQuantizeLayerCPUTest : public testing::WithParamInterface<fqLayerTestParamsSet>,
|
class FakeQuantizeLayerCPUTest : public testing::WithParamInterface<fqLayerTestParamsSet>,
|
||||||
// virtual public LayerTestsUtils::LayerTestsCommon, public CPUTestsBase {
|
virtual public SubgraphBaseTest, public CPUTestsBase {
|
||||||
//public:
|
public:
|
||||||
// static std::string getTestCaseName(testing::TestParamInfo<fqLayerTestParamsSet> obj) {
|
static std::string getTestCaseName(testing::TestParamInfo<fqLayerTestParamsSet> obj) {
|
||||||
// fqSpecificParams fqParams;
|
fqSpecificParams fqParams;
|
||||||
// inputShapes testShapes;
|
inputShapes testShapes;
|
||||||
// Precision inPrec;
|
Precision inPrec;
|
||||||
// std::pair<std::vector<float>, std::vector<float>> inputRangesValues;
|
std::pair<std::vector<float>, std::vector<float>> inputRangesValues;
|
||||||
// bool shouldBeDecomposed;
|
bool shouldBeDecomposed;
|
||||||
// CPUSpecificParams cpuParams;
|
CPUSpecificParams cpuParams;
|
||||||
// std::tie(fqParams, testShapes, inPrec, inputRangesValues, shouldBeDecomposed, cpuParams) = obj.param;
|
std::tie(fqParams, testShapes, inPrec, inputRangesValues, shouldBeDecomposed, cpuParams) = obj.param;
|
||||||
//
|
|
||||||
// std::vector<ngraph::PartialShape> dynamicShapes;
|
InputShape shapes;
|
||||||
// std::vector<ngraph::Shape> targetShapes;
|
std::vector<SizeVector> ranges;
|
||||||
// std::vector<SizeVector> ranges;
|
std::tie(shapes, ranges) = testShapes;
|
||||||
// std::tie(dynamicShapes, targetShapes, ranges) = testShapes;
|
|
||||||
//
|
int64_t inDataLowBounds, inDataHighBounds;
|
||||||
// int64_t inDataLowBounds, inDataHighBounds;
|
std::vector<float> inputLow, inputHigh, outputLow, outputHigh;
|
||||||
// std::vector<float> inputLow, inputHigh, outputLow, outputHigh;
|
size_t levels;
|
||||||
// size_t levels;
|
inputLow = inputRangesValues.first;
|
||||||
// inputLow = inputRangesValues.first;
|
inputHigh = inputRangesValues.second;
|
||||||
// inputHigh = inputRangesValues.second;
|
std::tie(inDataLowBounds, inDataHighBounds, outputLow, outputHigh, levels) = fqParams;
|
||||||
// std::tie(inDataLowBounds, inDataHighBounds, outputLow, outputHigh, levels) = fqParams;
|
|
||||||
//
|
std::ostringstream result;
|
||||||
// std::ostringstream result;
|
|
||||||
// if (!dynamicShapes.empty()) {
|
result << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_";
|
||||||
// result << "IS=" << CommonTestUtils::partialShape2str(dynamicShapes) << "_";
|
result << "TS=";
|
||||||
// }
|
for (const auto& shape : shapes.second) {
|
||||||
// result << "TS=";
|
result << "(" << CommonTestUtils::vec2str(shape) << ")_";
|
||||||
// for (const auto& shape : targetShapes) {
|
}
|
||||||
// result << "(" << CommonTestUtils::vec2str(shape) << ")_";
|
result << "RS=";
|
||||||
// }
|
for (const auto& data : ranges) {
|
||||||
// result << "RS=";
|
result << "(" << CommonTestUtils::vec2str(data) << ")_";
|
||||||
// for (const auto& data : ranges) {
|
}
|
||||||
// result << "(" << CommonTestUtils::vec2str(data) << ")_";
|
result << "inPrec=" << inPrec.name() << "_";
|
||||||
// }
|
|
||||||
// result << "inPrec=" << inPrec.name() << "_";
|
result << "LOW_BOUNDS=" << inDataLowBounds << "_";
|
||||||
//
|
result << "HIGH_BOUNDS=" << inDataHighBounds << "_";
|
||||||
// result << "LOW_BOUNDS=" << inDataLowBounds << "_";
|
result << "IL=" << CommonTestUtils::vec2str(inputLow) << "_";
|
||||||
// result << "HIGH_BOUNDS=" << inDataHighBounds << "_";
|
result << "IH=" << CommonTestUtils::vec2str(inputHigh) << "_";
|
||||||
// result << "IL=" << CommonTestUtils::vec2str(inputLow) << "_";
|
result << "OL=" << CommonTestUtils::vec2str(outputLow) << "_";
|
||||||
// result << "IH=" << CommonTestUtils::vec2str(inputHigh) << "_";
|
result << "OH=" << CommonTestUtils::vec2str(outputHigh) << "_";
|
||||||
// result << "OL=" << CommonTestUtils::vec2str(outputLow) << "_";
|
result << "LEVELS=" << levels;
|
||||||
// result << "OH=" << CommonTestUtils::vec2str(outputHigh) << "_";
|
|
||||||
// result << "LEVELS=" << levels;
|
result << CPUTestsBase::getTestCaseName(cpuParams);
|
||||||
//
|
|
||||||
// result << CPUTestsBase::getTestCaseName(cpuParams);
|
return result.str();
|
||||||
//
|
}
|
||||||
// return result.str();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// void Infer() override {
|
protected:
|
||||||
// inferRequest = executableNetwork.CreateInferRequest();
|
std::string layerName;
|
||||||
// inputs.clear();
|
|
||||||
//
|
void SetUp() override {
|
||||||
// const InputsDataMap &inDataMap = cnnNetwork.getInputsInfo();
|
targetDevice = CommonTestUtils::DEVICE_CPU;
|
||||||
// auto input = inDataMap.begin();
|
fqSpecificParams fqParams;
|
||||||
//
|
inputShapes testShapes;
|
||||||
// const auto td = input->second->getTensorDesc();
|
Precision inPrec;
|
||||||
// Blob::Ptr blob = FuncTestUtils::createAndFillBlob(InferenceEngine::TensorDesc(td.getPrecision(), targetStaticShapes[index][0], td.getLayout()),
|
std::pair<std::vector<float>, std::vector<float>> inputRangesValues;
|
||||||
// inDataHighBounds - inDataLowBounds, inDataLowBounds);
|
bool shouldBeDecomposed;
|
||||||
// inferRequest.SetBlob(input->second->name(), blob);
|
CPUSpecificParams cpuParams;
|
||||||
// inputs.push_back(blob);
|
std::tie(fqParams, testShapes, inPrec, inputRangesValues, shouldBeDecomposed, cpuParams) = this->GetParam();
|
||||||
//
|
|
||||||
// inferRequest.Infer();
|
std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
|
||||||
// }
|
|
||||||
//
|
InputShape shapes;
|
||||||
//protected:
|
std::vector<SizeVector> ranges;
|
||||||
// std::string layerName;
|
std::tie(shapes, ranges) = testShapes;
|
||||||
//
|
|
||||||
// void SetUp() override {
|
inputDynamicShapes.push_back(shapes.first);
|
||||||
// targetDevice = CommonTestUtils::DEVICE_CPU;
|
for (size_t i = 0; i < shapes.second.size(); i++) {
|
||||||
// fqSpecificParams fqParams;
|
targetStaticShapes.push_back(std::vector<ov::Shape>{shapes.second[i]});
|
||||||
// inputShapes testShapes;
|
}
|
||||||
// Precision inPrec;
|
|
||||||
// std::pair<std::vector<float>, std::vector<float>> inputRangesValues;
|
size_t levels;
|
||||||
// bool shouldBeDecomposed;
|
std::vector<std::vector<float>> rangesBounds(RANGES_INPUT_NUMBER);
|
||||||
// CPUSpecificParams cpuParams;
|
rangesBounds[0] = inputRangesValues.first;
|
||||||
// std::tie(fqParams, testShapes, inPrec, inputRangesValues, shouldBeDecomposed, cpuParams) = this->GetParam();
|
rangesBounds[1] = inputRangesValues.second;
|
||||||
//
|
std::tie(inDataLowBounds, inDataHighBounds, rangesBounds[2], rangesBounds[3], levels) = fqParams;
|
||||||
// std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
|
|
||||||
//
|
auto ngInPrec = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inPrec);
|
||||||
// std::vector<ngraph::Shape> targetShapes;
|
ParameterVector params = builder::makeDynamicParams(ngInPrec, inputDynamicShapes);
|
||||||
// std::vector<SizeVector> ranges;
|
auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<opset5::Parameter>(params));
|
||||||
// std::tie(inputDynamicShapes, targetShapes, ranges) = testShapes;
|
|
||||||
//
|
auto il = builder::makeConstant(ngInPrec, ranges[0], rangesBounds[0], rangesBounds[0].empty());
|
||||||
// for (size_t i = 0; i < targetShapes.size(); i++) {
|
auto ih = builder::makeConstant(ngInPrec, ranges[1], rangesBounds[1], rangesBounds[1].empty());
|
||||||
// targetStaticShapes.push_back(std::vector<ov::Shape>{targetShapes});
|
auto ol = builder::makeConstant(ngInPrec, ranges[2], rangesBounds[2], rangesBounds[2].empty());
|
||||||
// }
|
auto oh = builder::makeConstant(ngInPrec, ranges[3], rangesBounds[3], rangesBounds[3].empty());
|
||||||
//
|
auto fq = std::make_shared<opset5::FakeQuantize>(paramOuts[0], il, ih, ol, oh, levels);
|
||||||
// size_t levels;
|
|
||||||
// std::vector<std::vector<float>> rangesBounds(RANGES_INPUT_NUMBER);
|
layerName = shouldBeDecomposed ? "" : "FakeQuantize";
|
||||||
// rangesBounds[0] = inputRangesValues.first;
|
|
||||||
// rangesBounds[1] = inputRangesValues.second;
|
if (selectedType.empty()) {
|
||||||
// std::tie(inDataLowBounds, inDataHighBounds, rangesBounds[2], rangesBounds[3], levels) = fqParams;
|
selectedType = getPrimitiveType() + "_" + inPrec.name();
|
||||||
//
|
}
|
||||||
// auto ngInPrec = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inPrec);
|
|
||||||
// ParameterVector params = builder::makeParams(ngInPrec, {targetStaticShapes[0][0]});
|
function = makeNgraphFunction(ngInPrec, params, fq, "FakeQuantizeCPU");
|
||||||
// auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<opset5::Parameter>(params));
|
}
|
||||||
//
|
|
||||||
// auto il = builder::makeConstant(ngInPrec, ranges[0], rangesBounds[0], rangesBounds[0].empty());
|
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override {
|
||||||
// auto ih = builder::makeConstant(ngInPrec, ranges[1], rangesBounds[1], rangesBounds[1].empty());
|
inputs.clear();
|
||||||
// auto ol = builder::makeConstant(ngInPrec, ranges[2], rangesBounds[2], rangesBounds[2].empty());
|
const auto& funcInputs = function->inputs();
|
||||||
// auto oh = builder::makeConstant(ngInPrec, ranges[3], rangesBounds[3], rangesBounds[3].empty());
|
ASSERT_EQ(funcInputs.size(), 1);
|
||||||
// auto fq = std::make_shared<opset5::FakeQuantize>(paramOuts[0], il, ih, ol, oh, levels);
|
const auto& funcInput = funcInputs[0];
|
||||||
//
|
ov::runtime::Tensor tensor;
|
||||||
// layerName = shouldBeDecomposed ? "" : "FakeQuantize";
|
tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(),
|
||||||
//
|
targetInputStaticShapes[0],
|
||||||
// if (selectedType.empty()) {
|
inDataHighBounds - inDataLowBounds,
|
||||||
// selectedType = getPrimitiveType() + "_" + inPrec.name();
|
inDataLowBounds);
|
||||||
// }
|
inputs.insert({funcInput.get_node_shared_ptr(), tensor});
|
||||||
//
|
}
|
||||||
// function = makeNgraphFunction(ngInPrec, params, fq, "FakeQuantizeCPU");
|
|
||||||
// }
|
private:
|
||||||
//
|
const size_t RANGES_INPUT_NUMBER = 4;
|
||||||
//private:
|
|
||||||
// const size_t RANGES_INPUT_NUMBER = 4;
|
int64_t inDataLowBounds, inDataHighBounds;
|
||||||
//
|
};
|
||||||
// int64_t inDataLowBounds, inDataHighBounds;
|
|
||||||
//};
|
TEST_P(FakeQuantizeLayerCPUTest, CompareWithRefs) {
|
||||||
//
|
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||||
//TEST_P(FakeQuantizeLayerCPUTest, CompareWithRefs) {
|
run();
|
||||||
// SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
|
||||||
// Run();
|
CheckPluginRelatedResults(executableNetwork, layerName);
|
||||||
//
|
}
|
||||||
// CheckPluginRelatedResults(executableNetwork, layerName);
|
|
||||||
//}
|
|
||||||
//
|
const std::vector<size_t> levels = {16, 255, 256};
|
||||||
//
|
|
||||||
//const std::vector<size_t> levels = {16, 255, 256};
|
int64_t dataLowBounds{-10}, dataHighBounds{10};
|
||||||
//
|
|
||||||
//int64_t dataLowBounds{-10}, dataHighBounds{10};
|
const std::vector<std::pair<std::vector<float>, std::vector<float>>> input_ranges = {
|
||||||
//
|
{{0.0f}, {5.f}},
|
||||||
//const std::vector<std::pair<std::vector<float>, std::vector<float>>> input_ranges = {
|
{{0.0f}, {}},
|
||||||
// {{0.0f}, {5.f}},
|
{{-10.0f}, {-5.f}}
|
||||||
// {{-10.0f}, {-5.f}}
|
};
|
||||||
//};
|
|
||||||
//
|
const std::vector<float> outputLow{5.0f}, outputHigh{25.0f};
|
||||||
//const std::vector<float> outputLow{5.0f}, outputHigh{25.0f};
|
|
||||||
//
|
const auto specificParams = ::testing::Combine(::testing::Values(dataLowBounds),
|
||||||
//const auto specificParams = ::testing::Combine(::testing::Values(dataLowBounds),
|
::testing::Values(dataHighBounds),
|
||||||
// ::testing::Values(dataHighBounds),
|
::testing::Values(outputLow),
|
||||||
// ::testing::Values(outputLow),
|
::testing::Values(outputHigh),
|
||||||
// ::testing::Values(outputHigh),
|
::testing::ValuesIn(levels));
|
||||||
// ::testing::ValuesIn(levels));
|
|
||||||
//
|
namespace fqImpl {
|
||||||
//namespace fqImpl {
|
|
||||||
//
|
std::vector<CPUSpecificParams> memForm4D_jit = {
|
||||||
//std::vector<CPUSpecificParams> memForm4D_jit = {
|
CPUSpecificParams({nchw}, {nchw}, {}, {}),
|
||||||
// CPUSpecificParams({nchw}, {nchw}, {}, {}),
|
CPUSpecificParams({nhwc}, {nhwc}, {}, {}),
|
||||||
// CPUSpecificParams({nhwc}, {nhwc}, {}, {}),
|
CPUSpecificParams({nChw16c}, {nChw16c}, {}, {})
|
||||||
// CPUSpecificParams({nChw16c}, {nChw16c}, {}, {})
|
};
|
||||||
//};
|
|
||||||
//
|
std::vector<inputShapes> rangesShapes4D_jit = {
|
||||||
//std::vector<inputShapes> rangesShapes4D_jit = {
|
inputShapes{
|
||||||
// inputShapes{
|
InputShape{{{4, 5, 6, 7}}, {{4, 5, 6, 7}}},
|
||||||
// {},
|
{{1, 5, 1, 1}, {1, 5, 1, 1}, {1, 5, 1, 1}, {1, 5, 1, 1}}
|
||||||
// {{4, 5, 6, 7}},
|
},
|
||||||
// {{1, 5, 1, 1}, {1, 5, 1, 1}, {1, 5, 1, 1}, {1, 5, 1, 1}}
|
inputShapes{
|
||||||
// },
|
InputShape{{{4, 5, 6, 7}}, {{4, 5, 6, 7}}},
|
||||||
// inputShapes{
|
{{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
||||||
// {},
|
},
|
||||||
// {{4, 5, 6, 7}},
|
inputShapes{
|
||||||
// {{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
InputShape{{-1, -1, -1, -1}, {{4, 5, 6, 7}, {1, 12, 1, 1}, {4, 1, 8, 2}, {1, 16, 6, 1}, {4, 5, 6, 7}}},
|
||||||
// },
|
{{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
||||||
// inputShapes{
|
},
|
||||||
// {{-1, -1, -1, -1}},
|
inputShapes{
|
||||||
// {{4, 5, 6, 7}, {1, 12, 1, 1}, {4, 1, 8, 2}, {1, 16, 6, 1}},
|
InputShape{{-1, -1, -1, -1}, {{4, 16, 6, 7}, {1, 16, 1, 1}, {7, 16, 1, 2}, {1, 16, 6, 1}, {4, 16, 6, 7}}},
|
||||||
// {{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
{{1, 16, 1, 1}, {1, 16, 1, 1}, {1, 16, 1, 1}, {1, 16, 1, 1}}
|
||||||
// },
|
},
|
||||||
// inputShapes{
|
};
|
||||||
// {{-1, -1, -1, -1}},
|
|
||||||
// {{4, 16, 6, 7}, {1, 16, 1, 1}, {7, 16, 1, 2}, {1, 16, 6, 1}},
|
const auto testParams4D_jit = ::testing::Combine(specificParams,
|
||||||
// {{1, 16, 1, 1}, {1, 16, 1, 1}, {1, 16, 1, 1}, {1, 16, 1, 1}}
|
::testing::ValuesIn(rangesShapes4D_jit),
|
||||||
// },
|
::testing::Values(Precision::FP32),
|
||||||
//};
|
::testing::ValuesIn(input_ranges),
|
||||||
//
|
::testing::Values(false),
|
||||||
//const auto testParams4D_jit = ::testing::Combine(specificParams,
|
::testing::ValuesIn(filterCPUSpecificParams(memForm4D_jit)));
|
||||||
// ::testing::ValuesIn(rangesShapes4D_jit),
|
INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_4D_jit, FakeQuantizeLayerCPUTest, testParams4D_jit, FakeQuantizeLayerCPUTest::getTestCaseName);
|
||||||
// ::testing::Values(Precision::FP32),
|
|
||||||
// ::testing::ValuesIn(input_ranges),
|
|
||||||
// ::testing::Values(false),
|
std::vector<CPUSpecificParams> memForm4D_ref = {
|
||||||
// ::testing::ValuesIn(filterCPUSpecificParams(memForm4D_jit)));
|
CPUSpecificParams({nchw}, {nchw}, {"ref_FP32"}, {"ref_FP32"})
|
||||||
//INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_4D_jit, FakeQuantizeLayerCPUTest, testParams4D_jit, FakeQuantizeLayerCPUTest::getTestCaseName);
|
};
|
||||||
//
|
|
||||||
//
|
std::vector<inputShapes> rangesShapes4D_ref = {
|
||||||
//std::vector<CPUSpecificParams> memForm4D_ref = {
|
inputShapes{
|
||||||
// CPUSpecificParams({nchw}, {nchw}, {"ref_FP32"}, {"ref_FP32"})
|
InputShape{{{4, 5, 6, 7}}, {{4, 5, 6, 7}}},
|
||||||
//};
|
{{4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}}
|
||||||
//
|
},
|
||||||
//std::vector<inputShapes> rangesShapes4D_ref = {
|
inputShapes{
|
||||||
// inputShapes{
|
InputShape{{-1, -1, -1, -1}, {{4, 16, 6, 7}, {4, 1, 1, 1}, {4, 16, 1, 2}, {4, 16, 6, 1}, {4, 16, 6, 7}}},
|
||||||
// {},
|
{{4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}}
|
||||||
// {{4, 5, 6, 7}},
|
},
|
||||||
// {{4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}}
|
};
|
||||||
// },
|
|
||||||
// inputShapes{
|
const auto testParams4D_ref = ::testing::Combine(specificParams,
|
||||||
// {{-1, -1, -1, -1}},
|
::testing::ValuesIn(rangesShapes4D_ref),
|
||||||
// {{4, 16, 6, 7}, {4, 1, 1, 1}, {4, 16, 1, 2}, {4, 16, 6, 1}},
|
::testing::Values(Precision::FP32),
|
||||||
// {{4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}, {4, 1, 1, 1}}
|
::testing::ValuesIn(input_ranges),
|
||||||
// },
|
::testing::Values(false),
|
||||||
//};
|
::testing::ValuesIn(memForm4D_ref));
|
||||||
//
|
INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_4D_ref, FakeQuantizeLayerCPUTest, testParams4D_ref, FakeQuantizeLayerCPUTest::getTestCaseName);
|
||||||
//const auto testParams4D_ref = ::testing::Combine(specificParams,
|
|
||||||
// ::testing::ValuesIn(rangesShapes4D_ref),
|
|
||||||
// ::testing::Values(Precision::FP32),
|
std::vector<CPUSpecificParams> memForm5D_jit = {
|
||||||
// ::testing::ValuesIn(input_ranges),
|
CPUSpecificParams({ncdhw}, {ncdhw}, {}, {}),
|
||||||
// ::testing::Values(false),
|
CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}),
|
||||||
// ::testing::ValuesIn(memForm4D_ref));
|
CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {})
|
||||||
//INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_4D_ref, FakeQuantizeLayerCPUTest, testParams4D_ref, FakeQuantizeLayerCPUTest::getTestCaseName);
|
};
|
||||||
//
|
|
||||||
//
|
std::vector<inputShapes> rangesShapes5D_jit = {
|
||||||
//std::vector<CPUSpecificParams> memForm5D_jit = {
|
inputShapes{
|
||||||
// CPUSpecificParams({ncdhw}, {ncdhw}, {}, {}),
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
// CPUSpecificParams({ndhwc}, {ndhwc}, {}, {}),
|
{{1, 4, 1, 1, 1}, {1, 4, 1, 1, 1}, {1, 4, 1, 1, 1}, {1, 4, 1, 1, 1}}
|
||||||
// CPUSpecificParams({nCdhw16c}, {nCdhw16c}, {}, {})
|
},
|
||||||
//};
|
inputShapes{
|
||||||
//
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
//std::vector<inputShapes> rangesShapes5D_jit = {
|
{{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}}
|
||||||
// inputShapes{
|
},
|
||||||
// {},
|
inputShapes{
|
||||||
// {{3, 4, 5, 6, 7}},
|
InputShape{{-1, -1, -1, -1, -1}, {{3, 4, 5, 6, 7}, {1, 12, 1, 1, 1}, {4, 1, 8, 2, 7}, {3, 4, 5, 6, 7}, {1, 16, 6, 5, 1}}},
|
||||||
// {{1, 4, 1, 1, 1}, {1, 4, 1, 1, 1}, {1, 4, 1, 1, 1}, {1, 4, 1, 1, 1}}
|
{{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}}
|
||||||
// },
|
},
|
||||||
// inputShapes{
|
inputShapes{
|
||||||
// {},
|
InputShape{{-1, -1, -1, -1, -1}, {{4, 16, 6, 7, 8}, {1, 16, 1, 1, 1}, {7, 16, 1, 2, 5}, {4, 16, 6, 7, 8}, {1, 16, 6, 1, 7}}},
|
||||||
// {{3, 4, 5, 6, 7}},
|
{{1, 16, 1, 1, 1}, {1, 16, 1, 1, 1}, {1, 16, 1, 1, 1}, {1, 16, 1, 1, 1}}
|
||||||
// {{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}}
|
},
|
||||||
// },
|
};
|
||||||
// inputShapes{
|
|
||||||
// {{-1, -1, -1, -1, -1}},
|
const auto testParams5D_jit = ::testing::Combine(specificParams,
|
||||||
// {{3, 4, 5, 6, 7}, {1, 12, 1, 1, 1}, {4, 1, 8, 2, 7}, {1, 16, 6, 5, 1}},
|
::testing::ValuesIn(rangesShapes5D_jit),
|
||||||
// {{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}}
|
::testing::Values(Precision::FP32),
|
||||||
// },
|
::testing::ValuesIn(input_ranges),
|
||||||
// inputShapes{
|
::testing::Values(false),
|
||||||
// {{-1, -1, -1, -1, -1}},
|
::testing::ValuesIn(filterCPUSpecificParams(memForm5D_jit)));
|
||||||
// {{4, 16, 6, 7, 8}, {1, 16, 1, 1, 1}, {7, 16, 1, 2, 5}, {1, 16, 6, 1, 7}},
|
|
||||||
// {{1, 16, 1, 1, 1}, {1, 16, 1, 1, 1}, {1, 16, 1, 1, 1}, {1, 16, 1, 1, 1}}
|
INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_5D_jit, FakeQuantizeLayerCPUTest, testParams5D_jit, FakeQuantizeLayerCPUTest::getTestCaseName);
|
||||||
// },
|
|
||||||
//};
|
|
||||||
//
|
std::vector<CPUSpecificParams> memForm5D_ref = {
|
||||||
//const auto testParams5D_jit = ::testing::Combine(specificParams,
|
CPUSpecificParams({ncdhw}, {ncdhw}, {"ref_FP32"}, {"ref_FP32"})
|
||||||
// ::testing::ValuesIn(rangesShapes5D_jit),
|
};
|
||||||
// ::testing::Values(Precision::FP32),
|
|
||||||
// ::testing::ValuesIn(input_ranges),
|
std::vector<inputShapes> rangesShapes5D_ref = {
|
||||||
// ::testing::Values(false),
|
inputShapes{
|
||||||
// ::testing::ValuesIn(filterCPUSpecificParams(memForm5D_jit)));
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
//
|
{{3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}}
|
||||||
//INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_5D_jit, FakeQuantizeLayerCPUTest, testParams5D_jit, FakeQuantizeLayerCPUTest::getTestCaseName);
|
},
|
||||||
//
|
inputShapes{
|
||||||
//
|
InputShape{{-1, -1, -1, -1, -1}, {{3, 16, 6, 7, 8}, {3, 16, 1, 1, 1}, {3, 16, 1, 2, 5}, {3, 16, 6, 1, 7}, {3, 16, 6, 7, 8}}},
|
||||||
//std::vector<CPUSpecificParams> memForm5D_ref = {
|
{{3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}}
|
||||||
// CPUSpecificParams({ncdhw}, {ncdhw}, {"ref_FP32"}, {"ref_FP32"})
|
},
|
||||||
//};
|
};
|
||||||
//
|
|
||||||
//std::vector<inputShapes> rangesShapes5D_ref = {
|
const auto testParams5D_ref = ::testing::Combine(specificParams,
|
||||||
// inputShapes{
|
::testing::ValuesIn(rangesShapes5D_ref),
|
||||||
// {},
|
::testing::Values(Precision::FP32),
|
||||||
// {{3, 4, 5, 6, 7}},
|
::testing::ValuesIn(input_ranges),
|
||||||
// {{3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}}
|
::testing::Values(false),
|
||||||
// },
|
::testing::ValuesIn(memForm5D_ref));
|
||||||
// inputShapes{
|
|
||||||
// {{-1, -1, -1, -1, -1}},
|
INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_5D_ref, FakeQuantizeLayerCPUTest, testParams5D_ref, FakeQuantizeLayerCPUTest::getTestCaseName);
|
||||||
// {{3, 16, 6, 7, 8}, {3, 16, 1, 1, 1}, {3, 16, 1, 2, 5}, {3, 16, 6, 1, 7}},
|
|
||||||
// {{3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}, {3, 1, 1, 1, 1}}
|
const auto specificParamsBin = ::testing::Combine(::testing::Values(dataLowBounds),
|
||||||
// },
|
::testing::Values(dataHighBounds),
|
||||||
//};
|
::testing::Values(std::vector<float>{0.0f}),
|
||||||
//
|
::testing::Values(std::vector<float>{1.0f}),
|
||||||
//const auto testParams5D_ref = ::testing::Combine(specificParams,
|
::testing::Values(2));
|
||||||
// ::testing::ValuesIn(rangesShapes5D_ref),
|
|
||||||
// ::testing::Values(Precision::FP32),
|
const auto testParamsBin4D = ::testing::Combine(specificParamsBin,
|
||||||
// ::testing::ValuesIn(input_ranges),
|
::testing::ValuesIn(rangesShapes4D_jit),
|
||||||
// ::testing::Values(false),
|
::testing::Values(Precision::FP32),
|
||||||
// ::testing::ValuesIn(memForm5D_ref));
|
::testing::Values(std::pair<std::vector<float>, std::vector<float>>{{3.0f}, {3.f}}),
|
||||||
//
|
::testing::Values(false),
|
||||||
//INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_5D_ref, FakeQuantizeLayerCPUTest, testParams5D_ref, FakeQuantizeLayerCPUTest::getTestCaseName);
|
::testing::Values(CPUSpecificParams()));
|
||||||
//
|
|
||||||
//const auto specificParamsBin = ::testing::Combine(::testing::Values(dataLowBounds),
|
INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_4D_bin, FakeQuantizeLayerCPUTest, testParamsBin4D, FakeQuantizeLayerCPUTest::getTestCaseName);
|
||||||
// ::testing::Values(dataHighBounds),
|
|
||||||
// ::testing::Values(std::vector<float>{0.0f}),
|
} // namespace fqImpl
|
||||||
// ::testing::Values(std::vector<float>{1.0f}),
|
|
||||||
// ::testing::Values(2));
|
namespace fqDecompos {
|
||||||
//
|
|
||||||
//const auto testParamsBin4D = ::testing::Combine(specificParamsBin,
|
std::vector<inputShapes> decomposeShapes = {
|
||||||
// ::testing::ValuesIn(rangesShapes4D_jit),
|
inputShapes{
|
||||||
// ::testing::Values(Precision::FP32),
|
InputShape{{4, 5, 6, 7}, {{4, 5, 6, 7}}},
|
||||||
// ::testing::Values(std::pair<std::vector<float>, std::vector<float>>{{3.0f}, {3.f}}),
|
{{4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}}
|
||||||
// ::testing::Values(false),
|
},
|
||||||
// ::testing::Values(CPUSpecificParams()));
|
inputShapes{
|
||||||
//
|
InputShape{{4, 5, 6, 7}, {{4, 5, 6, 7}}},
|
||||||
//INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_4D_bin, FakeQuantizeLayerCPUTest, testParamsBin4D, FakeQuantizeLayerCPUTest::getTestCaseName);
|
{{1, 5, 1, 1}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
||||||
//
|
},
|
||||||
//} // namespace fqImpl
|
inputShapes{
|
||||||
//
|
InputShape{{4, 5, 6, 7}, {{4, 5, 6, 7}}},
|
||||||
//namespace fqDecompos {
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
||||||
//
|
},
|
||||||
//std::vector<inputShapes> decomposeShapes = {
|
inputShapes{
|
||||||
// inputShapes{
|
InputShape{{4, 5, 6, 7}, {{4, 5, 6, 7}}},
|
||||||
// {},
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
||||||
// {{4, 5, 6, 7}},
|
},
|
||||||
// {{4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}}
|
inputShapes{
|
||||||
// },
|
InputShape{{4, 5, 6, 7}, {{4, 5, 6, 7}}},
|
||||||
// inputShapes{
|
{{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
||||||
// {},
|
},
|
||||||
// {{4, 5, 6, 7}},
|
inputShapes{
|
||||||
// {{1, 5, 1, 1}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
// },
|
{{4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}}
|
||||||
// inputShapes{
|
},
|
||||||
// {},
|
inputShapes{
|
||||||
// {{4, 5, 6, 7}},
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
{{1, 5, 1, 1}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
||||||
// },
|
},
|
||||||
// inputShapes{
|
inputShapes{
|
||||||
// {},
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
// {{4, 5, 6, 7}},
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
},
|
||||||
// },
|
inputShapes{
|
||||||
// inputShapes{
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
// {},
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
||||||
// {{4, 5, 6, 7}},
|
},
|
||||||
// {{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
inputShapes{
|
||||||
// },
|
InputShape{{3, 4, 5, 6, 7}, {{3, 4, 5, 6, 7}}},
|
||||||
// inputShapes{
|
{{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
||||||
// {},
|
},
|
||||||
// {{3, 4, 5, 6, 7}},
|
inputShapes{
|
||||||
// {{4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}}
|
InputShape{{2, 3, 4, 5, 6, 7}, {{2, 3, 4, 5, 6, 7}}},
|
||||||
// },
|
{{4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}}
|
||||||
// inputShapes{
|
},
|
||||||
// {},
|
inputShapes{
|
||||||
// {{3, 4, 5, 6, 7}},
|
InputShape{{2, 3, 4, 5, 6, 7}, {{2, 3, 4, 5, 6, 7}}},
|
||||||
// {{1, 5, 1, 1}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
{{1, 5, 1, 1}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
||||||
// },
|
},
|
||||||
// inputShapes{
|
inputShapes{
|
||||||
// {},
|
InputShape{{2, 3, 4, 5, 6, 7}, {{2, 3, 4, 5, 6, 7}}},
|
||||||
// {{3, 4, 5, 6, 7}},
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
},
|
||||||
// },
|
inputShapes{
|
||||||
// inputShapes{
|
InputShape{{2, 3, 4, 5, 6, 7}, {{2, 3, 4, 5, 6, 7}}},
|
||||||
// {},
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
||||||
// {{3, 4, 5, 6, 7}},
|
},
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
inputShapes{
|
||||||
// },
|
InputShape{{2, 3, 4, 5, 6, 7}, {{2, 3, 4, 5, 6, 7}}},
|
||||||
// inputShapes{
|
{{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
||||||
// {},
|
},
|
||||||
// {{3, 4, 5, 6, 7}},
|
inputShapes{
|
||||||
// {{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
InputShape{{-1, -1, -1, -1}, {{4, 5, 6, 7}, {1, 5, 6, 7}, {7, 5, 6, 7}, {4, 5, 6, 7}}},
|
||||||
// },
|
{{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
||||||
// inputShapes{
|
},
|
||||||
// {},
|
inputShapes{
|
||||||
// {{2, 3, 4, 5, 6, 7}},
|
InputShape{{-1, -1, -1, -1, -1}, {{8, 4, 5, 6, 7}, {1, 1, 5, 6, 7}, {1, 1, 1, 6, 7}, {8, 4, 5, 6, 7}}},
|
||||||
// {{4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}, {4, 5, 6, 7}}
|
{{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
||||||
// },
|
},
|
||||||
// inputShapes{
|
};
|
||||||
// {},
|
|
||||||
// {{2, 3, 4, 5, 6, 7}},
|
const auto testParams = ::testing::Combine(specificParams,
|
||||||
// {{1, 5, 1, 1}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
::testing::ValuesIn(decomposeShapes),
|
||||||
// },
|
::testing::Values(Precision::FP32),
|
||||||
// inputShapes{
|
::testing::ValuesIn(input_ranges),
|
||||||
// {},
|
::testing::Values(true),
|
||||||
// {{2, 3, 4, 5, 6, 7}},
|
::testing::Values(CPUSpecificParams{}));
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 6, 7}}
|
|
||||||
// },
|
INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_Decompos, FakeQuantizeLayerCPUTest, testParams, FakeQuantizeLayerCPUTest::getTestCaseName);
|
||||||
// inputShapes{
|
|
||||||
// {},
|
} // namespace fqDecompos
|
||||||
// {{2, 3, 4, 5, 6, 7}},
|
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
} // namespace CPULayerTestsDefinitions
|
||||||
// },
|
|
||||||
// inputShapes{
|
|
||||||
// {},
|
|
||||||
// {{2, 3, 4, 5, 6, 7}},
|
|
||||||
// {{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
|
||||||
// },
|
|
||||||
// inputShapes{
|
|
||||||
// {{-1, -1, -1, -1}},
|
|
||||||
// {{4, 5, 6, 7}, {1, 5, 6, 7}, {7, 5, 6, 7}},
|
|
||||||
// {{1, 1, 6, 1}, {1, 5, 6, 7}, {1, 1, 6, 1}, {1, 1, 6, 1}}
|
|
||||||
// },
|
|
||||||
// inputShapes{
|
|
||||||
// {{-1, -1, -1, -1, -1}},
|
|
||||||
// {{8, 4, 5, 6, 7}, {1, 1, 5, 6, 7}, {1, 1, 1, 6, 7}},
|
|
||||||
// {{1, 1, 6, 7}, {1, 1, 6, 7}, {1, 1, 1, 1}, {1, 1, 1, 1}}
|
|
||||||
// },
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
//const auto testParams = ::testing::Combine(specificParams,
|
|
||||||
// ::testing::ValuesIn(decomposeShapes),
|
|
||||||
// ::testing::Values(Precision::FP32),
|
|
||||||
// ::testing::ValuesIn(input_ranges),
|
|
||||||
// ::testing::Values(true),
|
|
||||||
// ::testing::Values(CPUSpecificParams{}));
|
|
||||||
//
|
|
||||||
//INSTANTIATE_TEST_SUITE_P(smoke_FakeQuantizeLayerCPUTest_Decompos, FakeQuantizeLayerCPUTest, testParams, FakeQuantizeLayerCPUTest::getTestCaseName);
|
|
||||||
//
|
|
||||||
//} // namespace fqDecompos
|
|
||||||
//
|
|
||||||
//} // namespace CPULayerTestsDefinitions
|
|
||||||
|
@ -593,7 +593,8 @@ const std::vector<InputShape> inputShapes4D_int8 = {
|
|||||||
{
|
{
|
||||||
{1, 32, 8, 8},
|
{1, 32, 8, 8},
|
||||||
{1, 32, 8, 4},
|
{1, 32, 8, 4},
|
||||||
{2, 32, 8, 12}
|
{2, 32, 8, 12},
|
||||||
|
{1, 32, 8, 8}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -603,7 +604,8 @@ const std::vector<InputShape> inputShapes4D_int8 = {
|
|||||||
{
|
{
|
||||||
{3, 16, 32, 32},
|
{3, 16, 32, 32},
|
||||||
{1, 16, 16, 12},
|
{1, 16, 16, 12},
|
||||||
{1, 16, 8, 8}
|
{1, 16, 8, 8},
|
||||||
|
{3, 16, 32, 32},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -631,7 +633,8 @@ const std::vector<InputShape> inputShapes5D_int8 = {
|
|||||||
{
|
{
|
||||||
{2, 32, 8, 8, 8},
|
{2, 32, 8, 8, 8},
|
||||||
{1, 32, 16, 20, 8},
|
{1, 32, 16, 20, 8},
|
||||||
{1, 32, 16, 16, 16}
|
{1, 32, 16, 16, 16},
|
||||||
|
{2, 32, 8, 8, 8}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -641,7 +644,8 @@ const std::vector<InputShape> inputShapes5D_int8 = {
|
|||||||
{
|
{
|
||||||
{1, 16, 16, 16, 16},
|
{1, 16, 16, 16, 16},
|
||||||
{1, 16, 16, 8, 12},
|
{1, 16, 16, 8, 12},
|
||||||
{2, 16, 8, 8, 8}
|
{2, 16, 8, 8, 8},
|
||||||
|
{1, 16, 16, 16, 16},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user