[CPU] Interpolate dynamism support (#8717)
This commit is contained in:
parent
63822e0bdb
commit
c8d5b20c95
@ -1303,6 +1303,19 @@ bool MKLDNNNode::inputShapesDefined() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MKLDNNNode::outputShapesDefined() const {
|
||||
for (size_t i = 0; i < outputShapes.size(); i++) {
|
||||
if (!getChildEdgesAtPort(i)[0]->getMemory().getDesc().isDefined()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MKLDNNNode::shapesDefined() const {
|
||||
return inputShapesDefined() && outputShapesDefined();
|
||||
}
|
||||
|
||||
bool MKLDNNNode::needPrepareParams() const {
|
||||
return inputShapesModified();
|
||||
}
|
||||
|
@ -707,6 +707,8 @@ protected:
|
||||
bool isDynamic = false;
|
||||
|
||||
bool inputShapesDefined() const;
|
||||
bool outputShapesDefined() const;
|
||||
bool shapesDefined() const;
|
||||
void updateLastInputDims();
|
||||
|
||||
bool inputShapesModified() const;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -97,6 +97,7 @@ public:
|
||||
void createPrimitive() override;
|
||||
bool created() const override;
|
||||
void execute(mkldnn::stream strm) override;
|
||||
void executeDynamicImpl(mkldnn::stream strm) override;
|
||||
bool canBeInPlace() const override {
|
||||
return false;
|
||||
}
|
||||
@ -104,83 +105,141 @@ public:
|
||||
|
||||
static bool isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept;
|
||||
|
||||
bool needShapeInfer() const override;
|
||||
std::vector<VectorDims> shapeInfer() const override;
|
||||
bool needPrepareParams() const override;
|
||||
void prepareParams() override;
|
||||
|
||||
private:
|
||||
// nearest neighbor
|
||||
void NNPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void NNCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
struct InterpolateAttrs {
|
||||
InterpolateMode mode;
|
||||
InterpolateCoordTransMode coordTransMode;
|
||||
InterpolateNearestMode nearestMode;
|
||||
bool antialias;
|
||||
float cubeCoeff;
|
||||
std::vector<int> padBegin;
|
||||
std::vector<int> padEnd;
|
||||
InferenceEngine::Precision inPrc;
|
||||
InferenceEngine::Precision outPrc;
|
||||
InterpolateLayoutType layout;
|
||||
} interpAttrs;
|
||||
|
||||
// onnx linear
|
||||
void linearOnnxCF(int outCoord, float scale, int inShape, int outShape, int& index0, int& index1, float& weight0, float& weight1);
|
||||
void linearOnnxPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void linearOnnxCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
class InterpolateExecutor {
|
||||
public:
|
||||
InterpolateExecutor(const InterpolateAttrs& interpAttrs,
|
||||
const VectorDims &srcDims,
|
||||
const VectorDims &dstDims,
|
||||
const std::vector<float> &dataScales);
|
||||
|
||||
// cubic
|
||||
std::vector<float> getCubicCoeffs(float mantissa, float a);
|
||||
void cubicPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW);
|
||||
void cubicCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW);
|
||||
void cubicRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW);
|
||||
virtual void exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) = 0;
|
||||
virtual ~InterpolateExecutor() = default;
|
||||
VectorDims getSrcDimPad5d() const { return srcDimPad5d; }
|
||||
|
||||
// linear
|
||||
void linearInterpolation(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW,
|
||||
float fx, float fy, float fz, int OD, int OH, int OW, int kernel_width, bool antialias);
|
||||
private:
|
||||
void buildTblNN(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector<float>& dataScales,
|
||||
InterpolateLayoutType layout, InterpolateNearestMode nearestMode);
|
||||
void buildTblLinearOnnx(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector<float>& dataScales,
|
||||
InterpolateLayoutType layout);
|
||||
void buildTblLinear(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector<float>& dataScales, int kernel_width,
|
||||
bool antialias);
|
||||
void buildTblCubic(const SizeVector& srcDimPad5d, const SizeVector& dstDim5d, const std::vector<float>& dataScales, float cubicCoeff,
|
||||
InterpolateLayoutType layout);
|
||||
|
||||
void buildTblNN(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector<float>& dataScales, InterpolateLayoutType layout);
|
||||
void buildTblLinearOnnx(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector<float>& dataScales, InterpolateLayoutType layout);
|
||||
void buildTblLinear(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector<float>& dataScales, int kernel_width, bool antialias);
|
||||
void buildTblCubic(SizeVector& srcDimPad5d, SizeVector& dstDim5d, std::vector<float>& dataScales, float cubicCoeff, InterpolateLayoutType layout);
|
||||
float coordTransToInput(int outCoord, float scale, int inShape, int outShape) const;
|
||||
int nearestRound(float origin, bool isDownsample, InterpolateNearestMode nearestMode) const;
|
||||
void linearOnnxCF(int outCoord, float scale, int inShape, int outShape, int& index0, int& index1, float& weight0, float& weight1);
|
||||
std::vector<float> getCubicCoeffs(float mantissa, float a);
|
||||
|
||||
void setPostOps(mkldnn::primitive_attr &attr, bool initWeights = false);
|
||||
protected:
|
||||
InterpolateMode mode;
|
||||
InterpolateCoordTransMode coordTransMode;
|
||||
InterpolateLayoutType configured_for_layout;
|
||||
VectorDims srcDimPad5d, dstDim5d;
|
||||
InferenceEngine::Precision inputPrec, outputPrec;
|
||||
size_t srcDataSize, dstDataSize;
|
||||
int spatialDimSize;
|
||||
size_t dataRank;
|
||||
std::vector<int> indexTable;
|
||||
};
|
||||
std::shared_ptr<InterpolateExecutor> execPtr = nullptr;
|
||||
|
||||
inline float coordTransToInput(int outCoord, float scale, int inShape, int outShape);
|
||||
inline int nearestRound(float origin, bool isDownsample);
|
||||
float getValue(const uint8_t *base, size_t offset, InferenceEngine::Precision prec);
|
||||
void setValue(uint8_t *base, size_t offset, float value, InferenceEngine::Precision prec);
|
||||
class InterpolateJitExecutor : public InterpolateExecutor {
|
||||
public:
|
||||
InterpolateJitExecutor(const InterpolateAttrs& interpAttrs,
|
||||
const VectorDims &srcDims,
|
||||
const VectorDims &dstDims,
|
||||
const std::vector<float> &dataScales,
|
||||
const mkldnn::primitive_attr &attr);
|
||||
|
||||
SizeVector getPaddedInputShape();
|
||||
std::vector<float> getScales();
|
||||
void exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) override;
|
||||
|
||||
static const size_t DATA_ID = 0;
|
||||
static const size_t TARGET_SHAPE_ID = 1;
|
||||
static const size_t SCALES_ID = 2;
|
||||
static const size_t AXES_ID = 3;
|
||||
const int LINEAR_KERNEL = 2;
|
||||
const int CUBIC_GRID_LEN = 4;
|
||||
private:
|
||||
// nearest neighbor
|
||||
void NNPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void NNCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
|
||||
// onnx linear
|
||||
void linearOnnxPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void linearOnnxCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
|
||||
// cubic
|
||||
void cubicPlanar(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW);
|
||||
void cubicCGathered(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW);
|
||||
|
||||
private:
|
||||
std::shared_ptr<jit_uni_interpolate_kernel> interpolateKernel = nullptr;
|
||||
};
|
||||
|
||||
class InterpolateRefExecutor : public InterpolateExecutor {
|
||||
public:
|
||||
InterpolateRefExecutor(const InterpolateAttrs& interpAttrs,
|
||||
const VectorDims &srcDims,
|
||||
const VectorDims &dstDims,
|
||||
const std::vector<float> &_dataScales) : dataScales(_dataScales), antialias(interpAttrs.antialias),
|
||||
InterpolateExecutor(interpAttrs, srcDims, dstDims, _dataScales) {}
|
||||
|
||||
void exec(const uint8_t *in_ptr_, uint8_t *out_ptr_) override;
|
||||
|
||||
private:
|
||||
void NNRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
void linearOnnxRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW, int OD, int OH, int OW);
|
||||
|
||||
void cubicRef(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int IH, int IW, int OH, int OW);
|
||||
void linearInterpolation(const uint8_t *in_ptr_, uint8_t *out_ptr_, int B, int C, int ID, int IH, int IW,
|
||||
float fx, float fy, float fz, int OD, int OH, int OW, int kernel_width, bool antialias);
|
||||
|
||||
static float getValue(const uint8_t *base, size_t offset, InferenceEngine::Precision prec);
|
||||
static void setValue(uint8_t *base, size_t offset, float value, InferenceEngine::Precision prec);
|
||||
|
||||
private:
|
||||
bool antialias;
|
||||
std::vector<float> dataScales;
|
||||
};
|
||||
|
||||
void setPostOps(mkldnn::primitive_attr &attr, const VectorDims &dims, bool initWeights = false);
|
||||
|
||||
static SizeVector getPaddedInputShape(const VectorDims &srcDims, const std::vector<int> &padBegin, const std::vector<int> &padEnd);
|
||||
std::vector<float> getScales(const VectorDims &srcDimPad, const VectorDims &dstDim);
|
||||
static size_t getSpatialDimsNum(const Dim rank);
|
||||
|
||||
static constexpr size_t DATA_ID = 0;
|
||||
static constexpr size_t TARGET_SHAPE_ID = 1;
|
||||
static constexpr size_t SCALES_ID = 2;
|
||||
static constexpr size_t AXES_ID = 3;
|
||||
static constexpr int CUBIC_GRID_LEN = 4;
|
||||
|
||||
InterpolateMode mode;
|
||||
InterpolateCoordTransMode coordTransMode = InterpolateCoordTransMode::half_pixel;
|
||||
bool antialias = false;
|
||||
std::vector<int> padBegin;
|
||||
std::vector<int> padEnd;
|
||||
bool hasPad = false;
|
||||
InterpolateNearestMode nearestMode = InterpolateNearestMode::round_prefer_floor;
|
||||
InterpolateShapeCalcMode shapeCalcMode;
|
||||
|
||||
float cubeCoeff = -0.75;
|
||||
|
||||
bool isAxesSpecified = false;
|
||||
// axes and scales from buffer, partical size.
|
||||
std::vector<int> axes;
|
||||
std::vector<float> scales;
|
||||
// target shape is dst dim, full size.
|
||||
SizeVector dstDim;
|
||||
SizeVector srcDim;
|
||||
SizeVector srcDimPad;
|
||||
int spatialDimSize = 1;
|
||||
|
||||
mkldnn::primitive_attr attr;
|
||||
std::vector<MKLDNNMemoryPtr> PostOpsIntBlobMemory;
|
||||
|
||||
InferenceEngine::Precision inputPrec, outputPrec;
|
||||
size_t srcDataSize = 0;
|
||||
size_t dstDataSize = 0;
|
||||
std::vector<float> lastScales;
|
||||
std::vector<int32_t> lastSizes;
|
||||
|
||||
InterpolateLayoutType configured_for_layout = InterpolateLayoutType::planar;
|
||||
|
||||
std::vector<int> indexTable;
|
||||
|
||||
std::shared_ptr<jit_uni_interpolate_kernel> interpolateKernel = nullptr;
|
||||
VectorDims lastOutputDims;
|
||||
|
||||
std::string errorPrefix;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
void prepareParams() override;;
|
||||
void prepareParams() override;
|
||||
void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); }
|
||||
|
||||
static bool isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept;
|
||||
|
@ -2,35 +2,95 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <shared_test_classes/single_layer/interpolate.hpp>
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
#include "test_utils/cpu_test_utils.hpp"
|
||||
#include "test_utils/fusing_test_utils.hpp"
|
||||
#include "functional_test_utils/ov_tensor_utils.hpp"
|
||||
#include "openvino/core/preprocess/pre_post_process.hpp"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace ov::test;
|
||||
using namespace CPUTestUtils;
|
||||
using ngraph::helpers::operator<<;
|
||||
|
||||
namespace CPULayerTestsDefinitions {
|
||||
|
||||
typedef std::tuple<
|
||||
LayerTestsDefinitions::InterpolateLayerTestParams,
|
||||
CPUSpecificParams,
|
||||
fusingSpecificParams,
|
||||
std::map<std::string, std::string>
|
||||
> InterpolateLayerCPUTestParamsSet;
|
||||
using InterpolateSpecificParams = std::tuple<ngraph::op::v4::Interpolate::InterpolateMode, // InterpolateMode
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode, // CoordinateTransformMode
|
||||
ngraph::op::v4::Interpolate::NearestMode, // NearestMode
|
||||
bool, // AntiAlias
|
||||
std::vector<size_t>, // PadBegin
|
||||
std::vector<size_t>, // PadEnd
|
||||
double>; // Cube coef
|
||||
|
||||
using ShapeParams = std::tuple<ngraph::op::v4::Interpolate::ShapeCalcMode, // ShapeCalculationMode
|
||||
InputShape, // Input shapes
|
||||
// params describing input, choice of which depends on ShapeCalcMode
|
||||
ngraph::helpers::InputLayerType, // input type
|
||||
std::vector<std::vector<float>>, // scales or sizes values
|
||||
std::vector<int64_t>>; // axes
|
||||
|
||||
using InterpolateLayerCPUTestParamsSet = std::tuple<InterpolateSpecificParams,
|
||||
ShapeParams,
|
||||
ElementType,
|
||||
CPUSpecificParams,
|
||||
fusingSpecificParams,
|
||||
std::map<std::string, std::string>>;
|
||||
|
||||
class InterpolateLayerCPUTest : public testing::WithParamInterface<InterpolateLayerCPUTestParamsSet>,
|
||||
virtual public LayerTestsUtils::LayerTestsCommon, public CpuTestWithFusing {
|
||||
virtual public SubgraphBaseTest, public CpuTestWithFusing {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<InterpolateLayerCPUTestParamsSet> obj) {
|
||||
LayerTestsDefinitions::InterpolateLayerTestParams basicParamsSet;
|
||||
InterpolateSpecificParams specificParams;
|
||||
ShapeParams shapeParams;
|
||||
ElementType prec;
|
||||
CPUSpecificParams cpuParams;
|
||||
fusingSpecificParams fusingParams;
|
||||
std::map<std::string, std::string> additionalConfig;
|
||||
std::tie(basicParamsSet, cpuParams, fusingParams, additionalConfig) = obj.param;
|
||||
std::tie(specificParams, shapeParams, prec, cpuParams, fusingParams, additionalConfig) = obj.param;
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateMode mode;
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode;
|
||||
ngraph::op::v4::Interpolate::NearestMode nearMode;
|
||||
bool antiAlias;
|
||||
std::vector<size_t> padBegin;
|
||||
std::vector<size_t> padEnd;
|
||||
double cubeCoef;
|
||||
std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
|
||||
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
||||
InputShape inputShapes;
|
||||
ngraph::helpers::InputLayerType shapeInputType;
|
||||
std::vector<std::vector<float>> shapeDataForInput;
|
||||
std::vector<int64_t> axes;
|
||||
std::tie(shapeCalcMode, inputShapes, shapeInputType, shapeDataForInput, axes) = shapeParams;
|
||||
|
||||
std::ostringstream result;
|
||||
result << LayerTestsDefinitions::InterpolateLayerTest::getTestCaseName(testing::TestParamInfo<LayerTestsDefinitions::InterpolateLayerTestParams>(
|
||||
basicParamsSet, 0));
|
||||
result << "ShapeCalcMode=" << shapeCalcMode << "_";
|
||||
result << "IS=";
|
||||
result << CommonTestUtils::partialShape2str({inputShapes.first}) << "_";
|
||||
result << "TS=";
|
||||
for (const auto& shape : inputShapes.second) {
|
||||
result << CommonTestUtils::vec2str(shape) << "_";
|
||||
}
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
||||
result << "Scales=";
|
||||
} else {
|
||||
result << "Sizes=";
|
||||
}
|
||||
for (const auto &data : shapeDataForInput) {
|
||||
result << CommonTestUtils::vec2str(data) << "_";
|
||||
}
|
||||
result << shapeInputType << "_";
|
||||
result << "InterpolateMode=" << mode << "_";
|
||||
result << "CoordinateTransformMode=" << transfMode << "_";
|
||||
result << "NearestMode=" << nearMode << "_";
|
||||
result << "CubeCoef=" << cubeCoef << "_";
|
||||
result << "Antialias=" << antiAlias << "_";
|
||||
result << "PB=" << CommonTestUtils::vec2str(padBegin) << "_";
|
||||
result << "PE=" << CommonTestUtils::vec2str(padEnd) << "_";
|
||||
result << "Axes=" << CommonTestUtils::vec2str(axes) << "_";
|
||||
result << "PRC=" << prec << "_";
|
||||
|
||||
result << CPUTestsBase::getTestCaseName(cpuParams);
|
||||
result << CpuTestWithFusing::getTestCaseName(fusingParams);
|
||||
@ -45,75 +105,168 @@ public:
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override {
|
||||
inputs.clear();
|
||||
const auto& funcInputs = function->inputs();
|
||||
for (int i = 0; i < funcInputs.size(); ++i) {
|
||||
const auto& funcInput = funcInputs[i];
|
||||
ov::runtime::Tensor tensor;
|
||||
|
||||
if (i == 1) {
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES) {
|
||||
tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], sizes[inferRequestNum].data());
|
||||
} else {
|
||||
tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], scales[inferRequestNum].data());
|
||||
}
|
||||
} else {
|
||||
tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256);
|
||||
}
|
||||
|
||||
inputs.insert({funcInput.get_node_shared_ptr(), tensor});
|
||||
}
|
||||
inferRequestNum++;
|
||||
}
|
||||
|
||||
void configure_model() override {
|
||||
ov::preprocess::PrePostProcessor p(function);
|
||||
{
|
||||
auto& params = function->get_parameters();
|
||||
for (size_t i = 0; i < params.size(); i++) {
|
||||
if (i > 0) {
|
||||
continue;
|
||||
}
|
||||
if (inType != ov::element::Type_t::undefined) {
|
||||
p.input(ov::preprocess::InputInfo(i)
|
||||
.tensor(ov::preprocess::InputTensorInfo().set_element_type(inType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
auto results = function->get_results();
|
||||
for (size_t i = 0; i < results.size(); i++) {
|
||||
if (outType != ov::element::Type_t::undefined) {
|
||||
p.output(ov::preprocess::OutputInfo(i)
|
||||
.tensor(ov::preprocess::OutputTensorInfo().set_element_type(outType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
function = p.build();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<std::vector<float>> scales;
|
||||
std::vector<std::vector<int32_t>> sizes;
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
||||
size_t inferRequestNum = 0;
|
||||
|
||||
void SetUp() override {
|
||||
LayerTestsDefinitions::InterpolateLayerTestParams basicParamsSet;
|
||||
targetDevice = CommonTestUtils::DEVICE_CPU;
|
||||
|
||||
InterpolateSpecificParams specificParams;
|
||||
ShapeParams shapeParams;
|
||||
ElementType ngPrc;
|
||||
CPUSpecificParams cpuParams;
|
||||
fusingSpecificParams fusingParams;
|
||||
std::map<std::string, std::string> additionalConfig;
|
||||
std::tie(basicParamsSet, cpuParams, fusingParams, additionalConfig) = this->GetParam();
|
||||
std::tie(specificParams, shapeParams, ngPrc, cpuParams, fusingParams, additionalConfig) = this->GetParam();
|
||||
|
||||
std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
|
||||
std::tie(postOpMgrPtr, fusedOps) = fusingParams;
|
||||
|
||||
LayerTestsDefinitions::InterpolateSpecificParams interpolateParams;
|
||||
std::vector<size_t> inputShape;
|
||||
std::vector<size_t> targetShape;
|
||||
Precision netPrecision;
|
||||
std::map<std::string, std::string> additional_config;
|
||||
std::tie(interpolateParams, netPrecision, inPrc, outPrc, inLayout, outLayout, inputShape,
|
||||
targetShape, targetDevice, additional_config) = basicParamsSet;
|
||||
configuration.insert(additionalConfig.begin(), additionalConfig.end());
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateMode mode;
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode coordinateTransformMode;
|
||||
ngraph::op::v4::Interpolate::NearestMode nearestMode;
|
||||
bool antialias;
|
||||
std::vector<size_t> padBegin, padEnd;
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode;
|
||||
ngraph::op::v4::Interpolate::NearestMode nearMode;
|
||||
bool antiAlias;
|
||||
std::vector<size_t> padBegin;
|
||||
std::vector<size_t> padEnd;
|
||||
double cubeCoef;
|
||||
std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
|
||||
|
||||
InputShape dataShape;
|
||||
ngraph::helpers::InputLayerType shapeInputType;
|
||||
std::vector<std::vector<float>> shapeDataForInput;
|
||||
std::vector<int64_t> axes;
|
||||
std::vector<float> scales;
|
||||
std::tie(mode, shapeCalcMode, coordinateTransformMode, nearestMode, antialias, padBegin, padEnd, cubeCoef, axes, scales) = interpolateParams;
|
||||
inPrc = outPrc = netPrecision;
|
||||
configuration.insert(additionalConfig.begin(), additionalConfig.end());
|
||||
using ShapeCalcMode = ngraph::op::v4::Interpolate::ShapeCalcMode;
|
||||
std::tie(shapeCalcMode, dataShape, shapeInputType, shapeDataForInput, axes) = shapeParams;
|
||||
|
||||
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
||||
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
||||
scales = shapeDataForInput;
|
||||
sizes.resize(scales.size(), std::vector<int32_t>(scales.front().size(), 0));
|
||||
} else {
|
||||
sizes.resize(shapeDataForInput.size());
|
||||
for (size_t i = 0; i < shapeDataForInput.size(); i++) {
|
||||
for (size_t j = 0; j < shapeDataForInput[i].size(); j++) {
|
||||
sizes[i].push_back(shapeDataForInput[i][j]);
|
||||
}
|
||||
}
|
||||
scales.resize(sizes.size(), std::vector<float>(sizes.front().size(), 0));
|
||||
}
|
||||
|
||||
auto constant = ngraph::opset3::Constant(ngraph::element::Type_t::i64, {targetShape.size()}, targetShape);
|
||||
std::vector<InputShape> inputShapes;
|
||||
inputShapes.push_back(dataShape);
|
||||
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||
inputShapes.push_back(InputShape({static_cast<int64_t>(axes.size())}, std::vector<ov::Shape>(dataShape.second.size(), {axes.size()})));
|
||||
}
|
||||
|
||||
auto scales_const = ngraph::opset3::Constant(ngraph::element::Type_t::f32, {scales.size()}, scales);
|
||||
if (additionalConfig[InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16] == InferenceEngine::PluginConfigParams::YES) {
|
||||
inType = outType = ngPrc = ElementType::bf16;
|
||||
rel_threshold = 1e-2f;
|
||||
} else {
|
||||
inType = outType = ngPrc;
|
||||
}
|
||||
|
||||
auto scalesInput = std::make_shared<ngraph::opset3::Constant>(scales_const);
|
||||
init_input_shapes(inputShapes);
|
||||
|
||||
auto secondaryInput = std::make_shared<ngraph::opset3::Constant>(constant);
|
||||
auto params = ngraph::builder::makeDynamicParams(ngPrc, {inputDynamicShapes.front()});
|
||||
|
||||
std::shared_ptr<ov::Node> sizesInput, scalesInput;
|
||||
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
||||
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||
auto paramNode = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()});
|
||||
params.push_back(paramNode);
|
||||
scalesInput = paramNode;
|
||||
} else {
|
||||
scalesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front());
|
||||
}
|
||||
sizesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front());
|
||||
} else {
|
||||
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||
auto paramNode = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()});
|
||||
params.push_back(paramNode);
|
||||
sizesInput = paramNode;
|
||||
} else {
|
||||
sizesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front());
|
||||
}
|
||||
scalesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front());
|
||||
}
|
||||
auto axesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i64, ov::Shape{axes.size()}, axes);
|
||||
|
||||
for (size_t i = 0; i < params.size(); i++) {
|
||||
params[i]->set_friendly_name(std::string("param_") + std::to_string(i));
|
||||
}
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateAttrs interpAttr{mode, shapeCalcMode, padBegin, padEnd, transfMode, nearMode,
|
||||
antiAlias, cubeCoef};
|
||||
|
||||
auto axesConst = ngraph::opset3::Constant(ngraph::element::Type_t::i64, {axes.size()}, axes);
|
||||
auto axesInput = std::make_shared<ngraph::opset3::Constant>(axesConst);
|
||||
ngraph::op::v4::Interpolate::InterpolateAttrs interpolateAttributes{mode, shapeCalcMode, padBegin,
|
||||
padEnd, coordinateTransformMode, nearestMode, antialias, cubeCoef};
|
||||
auto interpolate = std::make_shared<ngraph::op::v4::Interpolate>(params[0],
|
||||
secondaryInput,
|
||||
sizesInput,
|
||||
scalesInput,
|
||||
axesInput,
|
||||
interpolateAttributes);
|
||||
function = makeNgraphFunction(ngPrc, params, interpolate, "interpolate");
|
||||
interpAttr);
|
||||
|
||||
function = makeNgraphFunction(ngPrc, params, interpolate, "InterpolateCPU");
|
||||
|
||||
if (selectedType.empty()) {
|
||||
selectedType = getPrimitiveType();
|
||||
}
|
||||
selectedType.push_back('_');
|
||||
if (additionalConfig.count(PluginConfigParams::KEY_ENFORCE_BF16) && additionalConfig[PluginConfigParams::KEY_ENFORCE_BF16] == PluginConfigParams::YES)
|
||||
selectedType += "BF16";
|
||||
else
|
||||
selectedType += netPrecision.name();
|
||||
selectedType = makeSelectedTypeStr(selectedType, ngPrc);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(InterpolateLayerCPUTest, CompareWithRefs) {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||
|
||||
Run();
|
||||
run();
|
||||
CheckPluginRelatedResults(executableNetwork, "Interpolate");
|
||||
}
|
||||
|
||||
@ -122,14 +275,14 @@ namespace {
|
||||
/* CPU PARAMS */
|
||||
std::vector<CPUSpecificParams> filterCPUInfoForDevice() {
|
||||
std::vector<CPUSpecificParams> resCPUParams;
|
||||
if (with_cpu_x86_avx512f()) {
|
||||
if (InferenceEngine::with_cpu_x86_avx512f()) {
|
||||
resCPUParams.push_back(CPUSpecificParams{{nChw16c, x, x, x}, {nChw16c}, {"jit_avx512"}, "jit_avx512"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_avx512"}, "jit_avx512"});
|
||||
} else if (with_cpu_x86_avx2()) {
|
||||
} else if (InferenceEngine::with_cpu_x86_avx2()) {
|
||||
resCPUParams.push_back(CPUSpecificParams{{nChw8c, x, x, x}, {nChw8c}, {"jit_avx2"}, "jit_avx2"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_avx2"}, "jit_avx2"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{nchw, x, x, x}, {nchw}, {"jit_avx2"}, "jit_avx2"});
|
||||
} else if (with_cpu_x86_sse42()) {
|
||||
} else if (InferenceEngine::with_cpu_x86_sse42()) {
|
||||
resCPUParams.push_back(CPUSpecificParams{{nChw8c, x, x, x}, {nChw8c}, {"jit_sse42"}, "jit_sse42"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_sse42"}, "jit_sse42"});
|
||||
} else {
|
||||
@ -138,11 +291,6 @@ std::vector<CPUSpecificParams> filterCPUInfoForDevice() {
|
||||
return resCPUParams;
|
||||
}
|
||||
/* ========== */
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
};
|
||||
|
||||
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModes = {
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::TF_HALF_PIXEL_FOR_NN,
|
||||
ngraph::op::v4::Interpolate::CoordinateTransformMode::PYTORCH_HALF_PIXEL,
|
||||
@ -168,11 +316,6 @@ const std::vector<ngraph::op::v4::Interpolate::NearestMode> defNearestModes = {
|
||||
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> pads = {
|
||||
{0, 0, 0, 0},
|
||||
{0, 0, 1, 1},
|
||||
};
|
||||
|
||||
const std::vector<bool> antialias = {
|
||||
false,
|
||||
};
|
||||
@ -181,152 +324,178 @@ const std::vector<double> cubeCoefs = {
|
||||
-0.75f,
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> defaultAxes = {
|
||||
{0, 1, 2, 3}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> defaultScales = {
|
||||
{1.f, 1.f, 1.25f, 1.5f}
|
||||
};
|
||||
|
||||
const auto interpolateCasesNN = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(nearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
const auto interpolateCasesLinearOnnx = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
const auto interpolateCasesLinear = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
const auto interpolateCasesCubic = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
const std::vector<fusingSpecificParams> interpolateFusingParamsSet{
|
||||
emptyFusingSpec,
|
||||
fusingRelu,
|
||||
fusingSwish,
|
||||
fusingFakeQuantizePerChannelRelu,
|
||||
fusingFakeQuantizePerTensorRelu,
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> additional_config = {};
|
||||
|
||||
std::vector<std::map<std::string, std::string>> filterAdditionalConfig() {
|
||||
if (with_cpu_x86_avx512f()) {
|
||||
if (InferenceEngine::with_cpu_x86_avx512f()) {
|
||||
return {
|
||||
{{PluginConfigParams::KEY_ENFORCE_BF16, PluginConfigParams::NO}},
|
||||
{{PluginConfigParams::KEY_ENFORCE_BF16, PluginConfigParams::YES}}
|
||||
{{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::NO}},
|
||||
{{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::YES}}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
// default config as an stub for target without avx512, otherwise all tests with BF16 in its name are skipped
|
||||
{{PluginConfigParams::KEY_PERF_COUNT, PluginConfigParams::NO}}
|
||||
{{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO}}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<std::vector<size_t>> pads4D = {
|
||||
{0, 0, 0, 0},
|
||||
{0, 0, 1, 1},
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> defaultAxes4D = {
|
||||
{0, 1, 2, 3}
|
||||
};
|
||||
|
||||
const std::vector<ShapeParams> shapeParams4D = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{}, {{1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{}, {{1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 11, 5, 6}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {1, 11, 5, 5}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 11, 5, 6}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1, 11, 6, 7}, {2, 7, 8, 7}},
|
||||
defaultAxes4D.front()
|
||||
}
|
||||
};
|
||||
|
||||
const auto interpolateCasesNN = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(nearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
interpolateCasesNN,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 4, 4})),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 5, 6})),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config)),
|
||||
interpolateCasesNN,
|
||||
::testing::ValuesIn(shapeParams4D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
const std::vector<ShapeParams> shapeParams4D_fixed_C = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{}, {{1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, 16, -1, -1}, {{1, 16, 4, 4}, {1, 16, 6, 5}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 16, 6, 7}},
|
||||
defaultAxes4D.front()
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCasesNN,
|
||||
::testing::ValuesIn(shapeParams4D_fixed_C),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice()),
|
||||
::testing::Values(fusingFakeQuantizePerChannelRelu),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesLinearOnnx = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
interpolateCasesLinearOnnx,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 4, 4})),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 5, 6})),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config)),
|
||||
interpolateCasesLinearOnnx,
|
||||
::testing::ValuesIn(shapeParams4D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesLinear = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinear_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
interpolateCasesLinear,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 4, 4})),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 5, 6})),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config)),
|
||||
interpolateCasesLinear,
|
||||
::testing::ValuesIn(shapeParams4D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesCubic = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(pads4D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
interpolateCasesCubic,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 4, 4})),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 5, 6})),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config)),
|
||||
interpolateCasesCubic,
|
||||
::testing::ValuesIn(shapeParams4D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
@ -335,14 +504,14 @@ INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerCPU
|
||||
////////////////////////5D/////////////////////////////
|
||||
std::vector<CPUSpecificParams> filterCPUInfoForDevice5D() {
|
||||
std::vector<CPUSpecificParams> resCPUParams;
|
||||
if (with_cpu_x86_avx512f()) {
|
||||
if (InferenceEngine::with_cpu_x86_avx512f()) {
|
||||
resCPUParams.push_back(CPUSpecificParams{{nCdhw16c, x, x, x}, {nCdhw16c}, {"jit_avx512"}, "jit_avx512"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_avx512"}, "jit_avx512"});
|
||||
} else if (with_cpu_x86_avx2()) {
|
||||
} else if (InferenceEngine::with_cpu_x86_avx2()) {
|
||||
resCPUParams.push_back(CPUSpecificParams{{nCdhw8c, x, x, x}, {nCdhw8c}, {"jit_avx2"}, "jit_avx2"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_avx2"}, "jit_avx2"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{ncdhw, x, x, x}, {ncdhw}, {"jit_avx2"}, "jit_avx2"});
|
||||
} else if (with_cpu_x86_sse42()) {
|
||||
} else if (InferenceEngine::with_cpu_x86_sse42()) {
|
||||
resCPUParams.push_back(CPUSpecificParams{{nCdhw8c, x, x, x}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"});
|
||||
resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_sse42"}, "jit_sse42"});
|
||||
} else {
|
||||
@ -359,70 +528,126 @@ const std::vector<std::vector<int64_t>> defaultAxes5D = {
|
||||
{0, 1, 2, 3, 4}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> defaultScales5D = {
|
||||
{1.f, 1.f, 1.25f, 1.5f, 0.5f}
|
||||
const std::vector<ShapeParams> shapeParams5D = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{}, {{1, 11, 4, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{}, {{1, 11, 4, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 11, 5, 6, 2}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {1, 11, 5, 5, 8}}},
|
||||
ngraph::helpers::InputLayerType::CONSTANT,
|
||||
{{1, 11, 5, 6, 4}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}, {1.f, 1.f, 1.25f, 1.25f, 1.25f}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1, 11, 6, 7, 2}, {2, 7, 8, 7, 4}},
|
||||
defaultAxes5D.front()
|
||||
},
|
||||
};
|
||||
|
||||
const auto interpolateCasesLinearOnnx5D = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(nearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes5D),
|
||||
::testing::ValuesIn(defaultScales5D));
|
||||
|
||||
const auto interpolateCasesNN5D = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(defaultAxes5D),
|
||||
::testing::ValuesIn(defaultScales5D));
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
interpolateCasesLinearOnnx5D,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 4, 4, 4})),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 5, 6, 2})),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config)),
|
||||
interpolateCasesLinearOnnx5D,
|
||||
::testing::ValuesIn(shapeParams5D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice5D()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
const auto interpolateCasesNN5D = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defNearestModes),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(pads5D),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN5D_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
interpolateCasesNN5D,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 4, 4, 4})),
|
||||
::testing::Values(std::vector<size_t>({1, 21, 5, 6, 2})),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config)),
|
||||
interpolateCasesNN5D,
|
||||
::testing::ValuesIn(shapeParams5D),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice5D()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
// corner cases
|
||||
const std::vector<ShapeParams> shapeParams4D_corner = {
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
||||
InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}},
|
||||
defaultAxes4D.front()
|
||||
},
|
||||
ShapeParams{
|
||||
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
||||
InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}},
|
||||
ngraph::helpers::InputLayerType::PARAMETER,
|
||||
{{1, 11, 6, 7}, {1, 11, 8, 7}},
|
||||
defaultAxes4D.front()
|
||||
}
|
||||
};
|
||||
|
||||
const auto interpolateCornerCases = ::testing::Combine(
|
||||
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
||||
::testing::Values(ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC),
|
||||
::testing::Values(ngraph::op::v4::Interpolate::NearestMode::SIMPLE),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::Values(std::vector<size_t>{0, 0, 0, 0}),
|
||||
::testing::Values(std::vector<size_t>{0, 0, 0, 0}),
|
||||
::testing::ValuesIn(cubeCoefs));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_corner_Layout_Test, InterpolateLayerCPUTest,
|
||||
::testing::Combine(
|
||||
interpolateCornerCases,
|
||||
::testing::ValuesIn(shapeParams4D_corner),
|
||||
::testing::Values(ElementType::f32),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice()),
|
||||
::testing::ValuesIn(interpolateFusingParamsSet),
|
||||
::testing::ValuesIn(filterAdditionalConfig())),
|
||||
InterpolateLayerCPUTest::getTestCaseName);
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace CPULayerTestsDefinitions
|
||||
|
Loading…
Reference in New Issue
Block a user