[CPU Tests] migrate sub_graph test cases - part 2 (#21379)
* [CPU Tests] migrate sub_graph test case - part 2 * remove unused header files --------- Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com>
This commit is contained in:
parent
f80793e420
commit
65b8bdf892
@ -2,28 +2,14 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <tuple>
|
#include "common_test_utils/node_builders/group_convolution.hpp"
|
||||||
#include <string>
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <debug.h>
|
|
||||||
#include <shared_test_classes/base/ov_subgraph.hpp>
|
|
||||||
#include <ov_models/builders.hpp>
|
|
||||||
#include "common_test_utils/common_utils.hpp"
|
|
||||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
|
||||||
#include "functional_test_utils/skip_tests_config.hpp"
|
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
|
|
||||||
|
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
|
||||||
#include "test_utils/convolution_params.hpp"
|
|
||||||
|
|
||||||
using namespace CPUTestUtils;
|
using namespace CPUTestUtils;
|
||||||
using namespace ov::test;
|
|
||||||
using namespace ngraph;
|
|
||||||
using namespace ngraph::helpers;
|
|
||||||
|
|
||||||
namespace CPUSubgraphTestsDefinitions {
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
|
|
||||||
typedef std::tuple<InputShape> groupConvLayerCPUTestParamsSet;
|
typedef std::tuple<InputShape> groupConvLayerCPUTestParamsSet;
|
||||||
|
|
||||||
@ -60,15 +46,23 @@ protected:
|
|||||||
|
|
||||||
ov::ParameterVector inputParams;
|
ov::ParameterVector inputParams;
|
||||||
for (auto&& shape : inputDynamicShapes) {
|
for (auto&& shape : inputDynamicShapes) {
|
||||||
inputParams.push_back(std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, shape));
|
inputParams.push_back(std::make_shared<ov::op::v0::Parameter>(ov::element::f32, shape));
|
||||||
}
|
}
|
||||||
conv = builder::makeGroupConvolution(inputParams[0], element::f32, kernelSize, strides, padBegin, padEnd, dilation,
|
conv = utils::make_group_convolution(inputParams[0],
|
||||||
paddingType, numOutChannels, numOfGroups);
|
element::f32,
|
||||||
|
kernelSize,
|
||||||
|
strides,
|
||||||
|
padBegin,
|
||||||
|
padEnd,
|
||||||
|
dilation,
|
||||||
|
paddingType,
|
||||||
|
numOutChannels,
|
||||||
|
numOfGroups);
|
||||||
|
|
||||||
ResultVector results;
|
ResultVector results;
|
||||||
results.push_back(std::make_shared<opset5::Result>(conv));
|
results.push_back(std::make_shared<ov::op::v0::Result>(conv));
|
||||||
|
|
||||||
function = std::make_shared<ngraph::Function>(results, inputParams, "groupConvolution");
|
function = std::make_shared<ov::Model>(results, inputParams, "groupConvolution");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,5 +90,6 @@ const auto groupConvTransformationParams = ::testing::Combine(::testing::ValuesI
|
|||||||
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvToConvTransformationTest, GroupConvToConvTransformationCPUTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvToConvTransformationTest, GroupConvToConvTransformationCPUTest,
|
||||||
groupConvTransformationParams, GroupConvToConvTransformationCPUTest::getTestCaseName);
|
groupConvTransformationParams, GroupConvToConvTransformationCPUTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace CPUSubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
@ -2,35 +2,23 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <debug.h>
|
|
||||||
#include <shared_test_classes/base/ov_subgraph.hpp>
|
|
||||||
#include <ov_models/builders.hpp>
|
|
||||||
#include "common_test_utils/common_utils.hpp"
|
#include "common_test_utils/common_utils.hpp"
|
||||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
#include "common_test_utils/node_builders/convolution.hpp"
|
||||||
#include "functional_test_utils/skip_tests_config.hpp"
|
#include "common_test_utils/node_builders/group_convolution.hpp"
|
||||||
|
#include "common_test_utils/ov_tensor_utils.hpp"
|
||||||
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
|
|
||||||
|
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
|
||||||
#include "test_utils/convolution_params.hpp"
|
|
||||||
|
|
||||||
using namespace InferenceEngine;
|
|
||||||
using namespace CPUTestUtils;
|
using namespace CPUTestUtils;
|
||||||
using namespace ov::test;
|
|
||||||
using namespace ngraph;
|
|
||||||
using namespace ngraph::helpers;
|
|
||||||
|
|
||||||
namespace CPUSubgraphTestsDefinitions {
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
|
|
||||||
typedef std::tuple<nodeType,
|
typedef std::tuple<nodeType, InputShape> conv1dConvertCPUTestParamsSet;
|
||||||
InputShape> conv1dConvertCPUTestParamsSet;
|
|
||||||
|
|
||||||
class Conv1dConvertTransformationCPUTest: public testing::WithParamInterface<conv1dConvertCPUTestParamsSet>,
|
class Conv1dConvertTransformationCPUTest : public testing::WithParamInterface<conv1dConvertCPUTestParamsSet>,
|
||||||
virtual public SubgraphBaseTest, public CPUTestsBase {
|
virtual public SubgraphBaseTest,
|
||||||
|
public CPUTestsBase {
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(testing::TestParamInfo<conv1dConvertCPUTestParamsSet> obj) {
|
static std::string getTestCaseName(testing::TestParamInfo<conv1dConvertCPUTestParamsSet> obj) {
|
||||||
InputShape inputShapes;
|
InputShape inputShapes;
|
||||||
@ -65,16 +53,16 @@ protected:
|
|||||||
|
|
||||||
ov::ParameterVector inputParams;
|
ov::ParameterVector inputParams;
|
||||||
for (auto&& shape : inputDynamicShapes) {
|
for (auto&& shape : inputDynamicShapes) {
|
||||||
inputParams.push_back(std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, shape));
|
inputParams.push_back(std::make_shared<ov::op::v0::Parameter>(ov::element::f32, shape));
|
||||||
}
|
}
|
||||||
switch (convType) {
|
switch (convType) {
|
||||||
case nodeType::convolution : {
|
case nodeType::convolution : {
|
||||||
conv = builder::makeConvolution(inputParams[0], element::f32, kernelSize, strides, padBegin, padEnd, dilation,
|
conv = utils::make_convolution(inputParams[0], element::f32, kernelSize, strides, padBegin, padEnd, dilation,
|
||||||
paddingType, numOutChannels);
|
paddingType, numOutChannels);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case nodeType::groupConvolution : {
|
case nodeType::groupConvolution : {
|
||||||
conv = builder::makeGroupConvolution(inputParams[0], element::f32, kernelSize, strides, padBegin, padEnd, dilation,
|
conv = utils::make_group_convolution(inputParams[0], element::f32, kernelSize, strides, padBegin, padEnd, dilation,
|
||||||
paddingType, numOutChannels, numOfGroups);
|
paddingType, numOutChannels, numOfGroups);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -84,9 +72,9 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultVector results;
|
ResultVector results;
|
||||||
results.push_back(std::make_shared<opset5::Result>(conv));
|
results.push_back(std::make_shared<ov::op::v0::Result>(conv));
|
||||||
|
|
||||||
function = std::make_shared<ngraph::Function>(results, inputParams, "convolution");
|
function = std::make_shared<ov::Model>(results, inputParams, "convolution");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,5 +120,6 @@ const auto groupConvTransformationParams = ::testing::Combine(::testing::ValuesI
|
|||||||
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvToConvTransformationTest, Conv1dConvertTransformationCPUTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvToConvTransformationTest, Conv1dConvertTransformationCPUTest,
|
||||||
groupConvTransformationParams, Conv1dConvertTransformationCPUTest::getTestCaseName);
|
groupConvTransformationParams, Conv1dConvertTransformationCPUTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace CPUSubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
@ -2,35 +2,22 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <debug.h>
|
|
||||||
#include <shared_test_classes/base/ov_subgraph.hpp>
|
|
||||||
#include <ov_models/builders.hpp>
|
|
||||||
#include "common_test_utils/common_utils.hpp"
|
#include "common_test_utils/common_utils.hpp"
|
||||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
#include "common_test_utils/node_builders/reduce.hpp"
|
||||||
#include "functional_test_utils/skip_tests_config.hpp"
|
#include "common_test_utils/ov_tensor_utils.hpp"
|
||||||
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
|
|
||||||
|
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
|
||||||
#include "test_utils/convolution_params.hpp"
|
|
||||||
|
|
||||||
using namespace InferenceEngine;
|
|
||||||
using namespace CPUTestUtils;
|
using namespace CPUTestUtils;
|
||||||
using namespace ov::test;
|
|
||||||
using namespace ngraph;
|
|
||||||
using namespace ngraph::helpers;
|
|
||||||
|
|
||||||
namespace CPUSubgraphTestsDefinitions {
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
|
|
||||||
typedef std::tuple<
|
typedef std::tuple<std::vector<int>, // Axis to reduce order
|
||||||
std::vector<int>, // Axis to reduce order
|
ov::test::utils::ReductionType, // Reduce operation type
|
||||||
ngraph::helpers::ReductionType, // Reduce operation type
|
std::vector<InputShape> // Input shapes
|
||||||
std::vector<InputShape> // Input shapes
|
>
|
||||||
> reduceConvertCPUTestParamsSet;
|
reduceConvertCPUTestParamsSet;
|
||||||
|
|
||||||
class reduceTransformationCPUTest: public testing::WithParamInterface<reduceConvertCPUTestParamsSet>,
|
class reduceTransformationCPUTest: public testing::WithParamInterface<reduceConvertCPUTestParamsSet>,
|
||||||
virtual public SubgraphBaseTest, public CPUTestsBase {
|
virtual public SubgraphBaseTest, public CPUTestsBase {
|
||||||
@ -38,7 +25,7 @@ public:
|
|||||||
static std::string getTestCaseName(testing::TestParamInfo<reduceConvertCPUTestParamsSet> obj) {
|
static std::string getTestCaseName(testing::TestParamInfo<reduceConvertCPUTestParamsSet> obj) {
|
||||||
std::vector<InputShape> inputShapes;
|
std::vector<InputShape> inputShapes;
|
||||||
std::vector<int> axes;
|
std::vector<int> axes;
|
||||||
ReductionType reductionType;
|
utils::ReductionType reductionType;
|
||||||
std::tie(axes, reductionType, inputShapes) = obj.param;
|
std::tie(axes, reductionType, inputShapes) = obj.param;
|
||||||
|
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
@ -65,18 +52,18 @@ protected:
|
|||||||
|
|
||||||
ov::ParameterVector params;
|
ov::ParameterVector params;
|
||||||
for (auto&& shape : inputDynamicShapes) {
|
for (auto&& shape : inputDynamicShapes) {
|
||||||
params.push_back(std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, shape));
|
params.push_back(std::make_shared<ov::op::v0::Parameter>(ov::element::f32, shape));
|
||||||
}
|
}
|
||||||
std::vector<size_t> shapeAxes;
|
std::vector<size_t> shapeAxes;
|
||||||
shapeAxes.push_back(axes.size());
|
shapeAxes.push_back(axes.size());
|
||||||
auto reductionAxesNode = std::dynamic_pointer_cast<ngraph::Node>(
|
auto reductionAxesNode = std::dynamic_pointer_cast<ov::Node>(
|
||||||
std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i64, ngraph::Shape(shapeAxes), axes));
|
std::make_shared<ov::op::v0::Constant>(ov::element::Type_t::i64, ov::Shape(shapeAxes), axes));
|
||||||
|
|
||||||
const auto reduce = ngraph::builder::makeReduce(params[0], reductionAxesNode, keepDims, reductionType);
|
const auto reduce = utils::make_reduce(params[0], reductionAxesNode, keepDims, reductionType);
|
||||||
function = makeNgraphFunction(ElementType::f32, params, reduce, "Reduce");
|
function = makeNgraphFunction(ElementType::f32, params, reduce, "Reduce");
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
ngraph::helpers::ReductionType reductionType;
|
utils::ReductionType reductionType;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(reduceTransformationCPUTest, CompareWithRefs) {
|
TEST_P(reduceTransformationCPUTest, CompareWithRefs) {
|
||||||
@ -88,11 +75,11 @@ namespace {
|
|||||||
std::vector<std::vector<ov::test::InputShape>> inputShapes = {
|
std::vector<std::vector<ov::test::InputShape>> inputShapes = {
|
||||||
{{{}, {{2, 19, 2, 9}}}}
|
{{{}, {{2, 19, 2, 9}}}}
|
||||||
};
|
};
|
||||||
const std::vector<ReductionType> reductionTypes = {
|
const std::vector<utils::ReductionType> reductionTypes = {
|
||||||
ReductionType::Min,
|
utils::ReductionType::Min,
|
||||||
ReductionType::Max,
|
utils::ReductionType::Max,
|
||||||
ReductionType::Sum,
|
utils::ReductionType::Sum,
|
||||||
ReductionType::Prod
|
utils::ReductionType::Prod
|
||||||
};
|
};
|
||||||
const std::vector<std::vector<int>> axes = {
|
const std::vector<std::vector<int>> axes = {
|
||||||
{0, 1},
|
{0, 1},
|
||||||
@ -114,5 +101,6 @@ const auto reduceTransformationParams = ::testing::Combine(::testing::ValuesIn(a
|
|||||||
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvToConvTransformationTest, reduceTransformationCPUTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvToConvTransformationTest, reduceTransformationCPUTest,
|
||||||
reduceTransformationParams, reduceTransformationCPUTest::getTestCaseName);
|
reduceTransformationParams, reduceTransformationCPUTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace CPUSubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
@ -32,23 +32,23 @@
|
|||||||
// |output|
|
// |output|
|
||||||
// --------
|
// --------
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <debug.h>
|
|
||||||
#include <shared_test_classes/base/ov_subgraph.hpp>
|
|
||||||
#include <ov_models/builders.hpp>
|
|
||||||
#include "common_test_utils/common_utils.hpp"
|
#include "common_test_utils/common_utils.hpp"
|
||||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
#include "common_test_utils/node_builders/eltwise.hpp"
|
||||||
#include "functional_test_utils/skip_tests_config.hpp"
|
#include "common_test_utils/ov_tensor_utils.hpp"
|
||||||
|
#include "ov_models/builders.hpp"
|
||||||
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
|
|
||||||
using namespace CPUTestUtils;
|
#include <memory>
|
||||||
using ngraph::helpers::EltwiseTypes;
|
#include <string>
|
||||||
using namespace ov::test;
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace CPUSubgraphTestsDefinitions {
|
using namespace CPUTestUtils;
|
||||||
|
|
||||||
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
|
using namespace ov::test::utils;
|
||||||
|
|
||||||
using InputShapesTuple = std::tuple<
|
using InputShapesTuple = std::tuple<
|
||||||
std::vector<InputShape>, // eltwise input shapes
|
std::vector<InputShape>, // eltwise input shapes
|
||||||
@ -122,7 +122,7 @@ public:
|
|||||||
return results.str();
|
return results.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override {
|
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override {
|
||||||
inputs.clear();
|
inputs.clear();
|
||||||
const auto& funcInputs = function->inputs();
|
const auto& funcInputs = function->inputs();
|
||||||
for (size_t i = 0; i < funcInputs.size(); ++i) {
|
for (size_t i = 0; i < funcInputs.size(); ++i) {
|
||||||
@ -155,31 +155,31 @@ protected:
|
|||||||
|
|
||||||
init_input_shapes(eltwiseInputShapes);
|
init_input_shapes(eltwiseInputShapes);
|
||||||
|
|
||||||
ngraph::ParameterVector ngraphParam;
|
ov::ParameterVector paramVec;
|
||||||
std::vector<std::shared_ptr<ngraph::Node>> ngraphInputs;
|
std::vector<std::shared_ptr<ov::Node>> inputNodes;
|
||||||
|
|
||||||
for (size_t i = 0; i < inputDynamicShapes.size(); i++) {
|
for (size_t i = 0; i < inputDynamicShapes.size(); i++) {
|
||||||
ngraphParam.push_back(std::make_shared<ngraph::opset1::Parameter>(inputPrecisions[i], inputDynamicShapes[i]));
|
paramVec.push_back(std::make_shared<ov::op::v0::Parameter>(inputPrecisions[i], inputDynamicShapes[i]));
|
||||||
ngraphInputs.push_back(ngraphParam.back());
|
inputNodes.push_back(paramVec.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lastNode0 = ngraph::builder::makeEltwise(ngraphParam[0], ngraphParam[1], eltwiseOpTypes[0]);
|
auto lastNode0 = utils::makeEltwise(paramVec[0], paramVec[1], eltwiseOpTypes[0]);
|
||||||
lastNode0->get_rt_info() = getCPUInfo();
|
lastNode0->get_rt_info() = getCPUInfo();
|
||||||
auto lastNode1 = ngraph::builder::makeEltwise(ngraphParam[2], ngraphParam[3], eltwiseOpTypes[1]);
|
auto lastNode1 = utils::makeEltwise(paramVec[2], paramVec[3], eltwiseOpTypes[1]);
|
||||||
lastNode1->get_rt_info() = getCPUInfo();
|
lastNode1->get_rt_info() = getCPUInfo();
|
||||||
if (withQuantization) {
|
if (withQuantization) {
|
||||||
lastNode0 = ngraph::builder::makeFakeQuantize(lastNode0, ::ngraph::element::Type(::ngraph::element::Type_t::f32),
|
lastNode0 = ngraph::builder::makeFakeQuantize(lastNode0, ov::element::Type(ov::element::Type_t::f32),
|
||||||
256, fqInputShapes[0]);
|
256, fqInputShapes[0]);
|
||||||
lastNode1 = ngraph::builder::makeFakeQuantize(lastNode1, ::ngraph::element::Type(::ngraph::element::Type_t::f32),
|
lastNode1 = ngraph::builder::makeFakeQuantize(lastNode1, ov::element::Type(ov::element::Type_t::f32),
|
||||||
256, fqInputShapes[1]);
|
256, fqInputShapes[1]);
|
||||||
}
|
}
|
||||||
if (needReshape) {
|
if (needReshape) {
|
||||||
auto reshapeConstNode = ngraph::builder::makeConstant(::ngraph::element::Type(::ngraph::element::Type_t::i32),
|
auto reshapeConstNode = ngraph::builder::makeConstant(ov::element::Type(ov::element::Type_t::i32),
|
||||||
{reshapeShape.size()}, reshapeShape);
|
{reshapeShape.size()}, reshapeShape);
|
||||||
lastNode1 = std::make_shared<ngraph::opset4::Reshape>(lastNode1, reshapeConstNode, false);
|
lastNode1 = std::make_shared<ov::op::v1::Reshape>(lastNode1, reshapeConstNode, false);
|
||||||
}
|
}
|
||||||
auto concat = std::make_shared<ov::op::v0::Concat>(ov::NodeVector{lastNode0, lastNode1}, 0);
|
auto concat = std::make_shared<ov::op::v0::Concat>(ov::NodeVector{lastNode0, lastNode1}, 0);
|
||||||
function = std::make_shared<ngraph::Function>(concat, ngraphParam, "eltwise_cache");
|
function = std::make_shared<ov::Model>(concat, paramVec, "eltwise_cache");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1328,5 +1328,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_EltwiseCache_7D_dyn, EltwiseCacheTest,
|
|||||||
::testing::Values(cpuParams_empty)),
|
::testing::Values(cpuParams_empty)),
|
||||||
EltwiseCacheTest::getTestCaseName);
|
EltwiseCacheTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace CPUSubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
@ -6,35 +6,36 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <debug.h>
|
|
||||||
#include <shared_test_classes/base/ov_subgraph.hpp>
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include <ov_models/builders.hpp>
|
#include "ov_models/builders.hpp"
|
||||||
#include "common_test_utils/common_utils.hpp"
|
#include "common_test_utils/common_utils.hpp"
|
||||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
#include "common_test_utils/ov_tensor_utils.hpp"
|
||||||
#include "functional_test_utils/skip_tests_config.hpp"
|
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
|
#include "common_test_utils/node_builders/eltwise.hpp"
|
||||||
|
|
||||||
using namespace CPUTestUtils;
|
using namespace CPUTestUtils;
|
||||||
using ngraph::helpers::EltwiseTypes;
|
|
||||||
using namespace ov::test;
|
|
||||||
|
|
||||||
namespace CPUSubgraphTestsDefinitions {
|
|
||||||
|
|
||||||
typedef std::tuple<
|
namespace ov {
|
||||||
std::vector<InputShape>, // Input shapes
|
namespace test {
|
||||||
ngraph::helpers::InputLayerType, // Secondary input type
|
using namespace ov::test::utils;
|
||||||
std::vector<ElementType>, // Input precisions
|
|
||||||
std::vector<EltwiseTypes>, // Eltwise operations
|
typedef std::tuple<std::vector<InputShape>, // Input shapes
|
||||||
bool, // With quantization
|
InputLayerType, // Secondary input type
|
||||||
std::string // Device name
|
std::vector<ElementType>, // Input precisions
|
||||||
> EltwiseChainTuple;
|
std::vector<EltwiseTypes>, // Eltwise operations
|
||||||
|
bool, // With quantization
|
||||||
|
std::string // Device name
|
||||||
|
>
|
||||||
|
EltwiseChainTuple;
|
||||||
|
|
||||||
class EltwiseChainTest : public testing::WithParamInterface<EltwiseChainTuple>,
|
class EltwiseChainTest : public testing::WithParamInterface<EltwiseChainTuple>,
|
||||||
virtual public SubgraphBaseTest {
|
virtual public SubgraphBaseTest {
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(const testing::TestParamInfo<EltwiseChainTuple> &obj) {
|
static std::string getTestCaseName(const testing::TestParamInfo<EltwiseChainTuple> &obj) {
|
||||||
std::vector<InputShape> inputShapes;
|
std::vector<InputShape> inputShapes;
|
||||||
ngraph::helpers::InputLayerType secondaryInputType;
|
InputLayerType secondaryInputType;
|
||||||
std::vector<ElementType> inputPrecisions;
|
std::vector<ElementType> inputPrecisions;
|
||||||
std::vector<EltwiseTypes> eltwiseOpTypes;
|
std::vector<EltwiseTypes> eltwiseOpTypes;
|
||||||
bool withQuantization;
|
bool withQuantization;
|
||||||
@ -65,7 +66,7 @@ public:
|
|||||||
return results.str();
|
return results.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override {
|
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override {
|
||||||
inputs.clear();
|
inputs.clear();
|
||||||
const auto& funcInputs = function->inputs();
|
const auto& funcInputs = function->inputs();
|
||||||
for (size_t i = 0; i < funcInputs.size(); ++i) {
|
for (size_t i = 0; i < funcInputs.size(); ++i) {
|
||||||
@ -81,7 +82,7 @@ protected:
|
|||||||
abs_threshold = 0.1f;
|
abs_threshold = 0.1f;
|
||||||
|
|
||||||
std::vector<InputShape> inputShapes;
|
std::vector<InputShape> inputShapes;
|
||||||
ngraph::helpers::InputLayerType secondaryInputType;
|
InputLayerType secondaryInputType;
|
||||||
std::vector<ElementType> inputPrecisions;
|
std::vector<ElementType> inputPrecisions;
|
||||||
std::vector<EltwiseTypes> eltwiseOpTypes;
|
std::vector<EltwiseTypes> eltwiseOpTypes;
|
||||||
bool withQuantization;
|
bool withQuantization;
|
||||||
@ -89,27 +90,27 @@ protected:
|
|||||||
|
|
||||||
init_input_shapes(inputShapes);
|
init_input_shapes(inputShapes);
|
||||||
|
|
||||||
ngraph::ParameterVector ngraphParam;
|
ov::ParameterVector paramVec;
|
||||||
std::vector<std::shared_ptr<ngraph::Node>> ngraphInputs;
|
std::vector<std::shared_ptr<ov::Node>> inputNodes;
|
||||||
if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
||||||
for (size_t i = 0; i < inputDynamicShapes.size(); i++) {
|
for (size_t i = 0; i < inputDynamicShapes.size(); i++) {
|
||||||
ngraphParam.push_back(std::make_shared<ngraph::opset1::Parameter>(inputPrecisions[i], inputDynamicShapes[i]));
|
paramVec.push_back(std::make_shared<ov::op::v0::Parameter>(inputPrecisions[i], inputDynamicShapes[i]));
|
||||||
ngraphInputs.push_back(ngraphParam.back());
|
inputNodes.push_back(paramVec.back());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ngraphParam = ov::ParameterVector {std::make_shared<ov::op::v0::Parameter>(inputPrecisions[0], inputDynamicShapes.front())};
|
paramVec = ov::ParameterVector {std::make_shared<ov::op::v0::Parameter>(inputPrecisions[0], inputDynamicShapes.front())};
|
||||||
for (size_t i = 1; i < inputPrecisions.size(); i++) {
|
for (size_t i = 1; i < inputPrecisions.size(); i++) {
|
||||||
std::vector<float> ngraphInput1Data(ngraph::shape_size(targetStaticShapes[0][i]));
|
std::vector<float> input1Data(ov::shape_size(targetStaticShapes[0][i]));
|
||||||
ngraphInputs.push_back(ngraph::builder::makeConstant(inputPrecisions[i], targetStaticShapes[0][i],
|
inputNodes.push_back(
|
||||||
ngraphInput1Data, true));
|
ngraph::builder::makeConstant(inputPrecisions[i], targetStaticShapes[0][i], input1Data, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (withQuantization) {
|
if (withQuantization) {
|
||||||
std::vector<std::shared_ptr<ngraph::Node>> eltwiseOps;
|
std::vector<std::shared_ptr<ov::Node>> eltwiseOps;
|
||||||
eltwiseOps.push_back(ngraph::builder::makeEltwise(ngraphParam[0], ngraphInputs[0], eltwiseOpTypes[0]));
|
eltwiseOps.push_back(makeEltwise(paramVec[0], inputNodes[0], eltwiseOpTypes[0]));
|
||||||
for (size_t i = 1; i < eltwiseOpTypes.size() - 1; i++) {
|
for (size_t i = 1; i < eltwiseOpTypes.size() - 1; i++) {
|
||||||
eltwiseOps.push_back(ngraph::builder::makeEltwise(eltwiseOps[eltwiseOps.size() - 1], ngraphInputs[i], eltwiseOpTypes[i]));
|
eltwiseOps.push_back(makeEltwise(eltwiseOps[eltwiseOps.size() - 1], inputNodes[i], eltwiseOpTypes[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<size_t> constShape(targetStaticShapes[0][0].size(), 1);
|
std::vector<size_t> constShape(targetStaticShapes[0][0].size(), 1);
|
||||||
@ -118,19 +119,19 @@ protected:
|
|||||||
::ngraph::element::Type(::ngraph::element::Type_t::f32),
|
::ngraph::element::Type(::ngraph::element::Type_t::f32),
|
||||||
256, constShape);
|
256, constShape);
|
||||||
|
|
||||||
eltwiseOps.push_back(ngraph::builder::makeEltwise(fq, ngraphInputs[eltwiseOpTypes.size() - 1], eltwiseOpTypes[eltwiseOpTypes.size() - 1]));
|
eltwiseOps.push_back(makeEltwise(fq, inputNodes[eltwiseOpTypes.size() - 1], eltwiseOpTypes[eltwiseOpTypes.size() - 1]));
|
||||||
|
|
||||||
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(eltwiseOps[eltwiseOps.size() - 1])};
|
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(eltwiseOps[eltwiseOps.size() - 1])};
|
||||||
function = std::make_shared<ngraph::Function>(results, ngraphParam, "eltwise_chain_fq");
|
function = std::make_shared<ov::Model>(results, paramVec, "eltwise_chain_fq");
|
||||||
} else {
|
} else {
|
||||||
std::vector<std::shared_ptr<ngraph::Node>> eltwiseOps;
|
std::vector<std::shared_ptr<ov::Node>> eltwiseOps;
|
||||||
eltwiseOps.push_back(ngraph::builder::makeEltwise(ngraphParam[0], ngraphInputs[0], eltwiseOpTypes[0]));
|
eltwiseOps.push_back(makeEltwise(paramVec[0], inputNodes[0], eltwiseOpTypes[0]));
|
||||||
for (size_t i = 1; i < eltwiseOpTypes.size(); i++) {
|
for (size_t i = 1; i < eltwiseOpTypes.size(); i++) {
|
||||||
eltwiseOps.push_back(ngraph::builder::makeEltwise(eltwiseOps[eltwiseOps.size() - 1], ngraphInputs[i], eltwiseOpTypes[i]));
|
eltwiseOps.push_back(makeEltwise(eltwiseOps[eltwiseOps.size() - 1], inputNodes[i], eltwiseOpTypes[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(eltwiseOps[eltwiseOps.size() - 1])};
|
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(eltwiseOps[eltwiseOps.size() - 1])};
|
||||||
function = std::make_shared<ngraph::Function>(results, ngraphParam, "eltwise_chain");
|
function = std::make_shared<ov::Model>(results, paramVec, "eltwise_chain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -141,7 +142,7 @@ TEST_P(EltwiseChainTest, CompareWithRefs) {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
std::vector<std::vector<ngraph::Shape>> inputShapes = {
|
std::vector<std::vector<ov::Shape>> inputShapes = {
|
||||||
{{1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}},
|
{{1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}},
|
||||||
{{1, 48, 5, 6}, {1, 48, 1, 1}, {1, 48, 5, 6}, {1, 1, 5, 6}},
|
{{1, 48, 5, 6}, {1, 48, 1, 1}, {1, 48, 5, 6}, {1, 1, 5, 6}},
|
||||||
{{1, 72, 28, 28}, {1, 72, 1, 1}, {1, 72, 1, 1}, {1, 72, 1, 1}},
|
{{1, 72, 28, 28}, {1, 72, 1, 1}, {1, 72, 1, 1}, {1, 72, 1, 1}},
|
||||||
@ -166,14 +167,14 @@ std::vector<std::vector<EltwiseTypes>> eltwiseOps = {
|
|||||||
INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChain, EltwiseChainTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChain, EltwiseChainTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::ValuesIn(static_shapes_to_test_representation(inputShapes)),
|
::testing::ValuesIn(static_shapes_to_test_representation(inputShapes)),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
|
::testing::Values(InputLayerType::CONSTANT),
|
||||||
::testing::ValuesIn(inputPrecisions),
|
::testing::ValuesIn(inputPrecisions),
|
||||||
::testing::ValuesIn(eltwiseOps),
|
::testing::ValuesIn(eltwiseOps),
|
||||||
::testing::Values(false),
|
::testing::Values(false),
|
||||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||||
EltwiseChainTest::getTestCaseName);
|
EltwiseChainTest::getTestCaseName);
|
||||||
|
|
||||||
std::vector<std::vector<ngraph::Shape>> inputShapesFQ = {
|
std::vector<std::vector<ov::Shape>> inputShapesFQ = {
|
||||||
{{1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}},
|
{{1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}},
|
||||||
{{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}},
|
{{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}},
|
||||||
{{2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}},
|
{{2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}},
|
||||||
@ -197,7 +198,7 @@ std::vector<std::vector<ElementType>> inputPrecisionsFQ {
|
|||||||
INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChainWithFQ, EltwiseChainTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChainWithFQ, EltwiseChainTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::ValuesIn(static_shapes_to_test_representation(inputShapesFQ)),
|
::testing::ValuesIn(static_shapes_to_test_representation(inputShapesFQ)),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
|
::testing::Values(InputLayerType::CONSTANT),
|
||||||
::testing::ValuesIn(inputPrecisionsFQ),
|
::testing::ValuesIn(inputPrecisionsFQ),
|
||||||
::testing::ValuesIn(eltwiseOps),
|
::testing::ValuesIn(eltwiseOps),
|
||||||
::testing::Values(true),
|
::testing::Values(true),
|
||||||
@ -455,12 +456,13 @@ std::vector<std::vector<InputShape>> inputShapes_dyn = {
|
|||||||
INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChain_dyn, EltwiseChainTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChain_dyn, EltwiseChainTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
::testing::ValuesIn(inputShapes_dyn),
|
::testing::ValuesIn(inputShapes_dyn),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
|
::testing::Values(InputLayerType::PARAMETER),
|
||||||
::testing::ValuesIn(inputPrecisions),
|
::testing::ValuesIn(inputPrecisions),
|
||||||
::testing::ValuesIn(eltwiseOps),
|
::testing::ValuesIn(eltwiseOps),
|
||||||
::testing::Values(false),
|
::testing::Values(false),
|
||||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||||
EltwiseChainTest::getTestCaseName);
|
EltwiseChainTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace CPUSubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
@ -22,9 +22,11 @@
|
|||||||
|
|
||||||
using namespace CPUTestUtils;
|
using namespace CPUTestUtils;
|
||||||
using namespace ov::gen_pattern;
|
using namespace ov::gen_pattern;
|
||||||
using namespace ov::test;
|
|
||||||
using namespace ov;
|
using namespace ov;
|
||||||
|
|
||||||
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
|
|
||||||
static ov::OutputVector makeCosSinCache(int max_position_embeddings, int rotary_ndims) {
|
static ov::OutputVector makeCosSinCache(int max_position_embeddings, int rotary_ndims) {
|
||||||
std::vector<float> lut_sin(max_position_embeddings * rotary_ndims, 0.0f);
|
std::vector<float> lut_sin(max_position_embeddings * rotary_ndims, 0.0f);
|
||||||
std::vector<float> lut_cos(max_position_embeddings * rotary_ndims, 0.0f);
|
std::vector<float> lut_cos(max_position_embeddings * rotary_ndims, 0.0f);
|
||||||
@ -129,8 +131,6 @@ static std::shared_ptr<ov::Model> buildROPE_Llama2(const int batch,
|
|||||||
return std::make_shared<ov::Model>(ov::NodeVector{add_Add}, ov::ParameterVector{input, pos_id_end, pos_ids});
|
return std::make_shared<ov::Model>(ov::NodeVector{add_Add}, ov::ParameterVector{input, pos_id_end, pos_ids});
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CPULayerTestsDefinitions {
|
|
||||||
|
|
||||||
class RoPECPUTestLlama2 : public SubgraphBaseTest {
|
class RoPECPUTestLlama2 : public SubgraphBaseTest {
|
||||||
public:
|
public:
|
||||||
ov::Tensor create_i32_tensor(const ov::Shape& shape, int start, int step = 1) {
|
ov::Tensor create_i32_tensor(const ov::Shape& shape, int start, int step = 1) {
|
||||||
@ -328,4 +328,5 @@ TEST_F(RoPECPUTestChatGLM, smoke_CompareWithRefs) {
|
|||||||
CheckNumberOfNodesWithType(compiledModel, "RoPE", 1);
|
CheckNumberOfNodesWithType(compiledModel, "RoPE", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CPULayerTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
@ -2,16 +2,19 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "common_test_utils/node_builders/gru_cell.hpp"
|
||||||
|
#include "common_test_utils/node_builders/lstm_cell.hpp"
|
||||||
|
#include "common_test_utils/node_builders/rnn_cell.hpp"
|
||||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include "ov_models/builders.hpp"
|
|
||||||
#include "test_utils/cpu_test_utils.hpp"
|
#include "test_utils/cpu_test_utils.hpp"
|
||||||
#include "transformations/op_conversions/bidirectional_sequences_decomposition.hpp"
|
#include "transformations/op_conversions/bidirectional_sequences_decomposition.hpp"
|
||||||
#include "transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp"
|
#include "transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp"
|
||||||
|
|
||||||
using namespace CPUTestUtils;
|
using namespace CPUTestUtils;
|
||||||
using namespace ov::test;
|
using namespace ov::test::utils;
|
||||||
|
|
||||||
namespace SubgraphTestsDefinitions {
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
|
|
||||||
enum class SEQ_TYPE {
|
enum class SEQ_TYPE {
|
||||||
GRU,
|
GRU,
|
||||||
@ -34,7 +37,7 @@ using SeqParams = std::tuple<SEQ_TYPE, // node type
|
|||||||
bool, // Linear_before_reset
|
bool, // Linear_before_reset
|
||||||
ov::op::RecurrentSequenceDirection, // Direction
|
ov::op::RecurrentSequenceDirection, // Direction
|
||||||
ElementType, // Network precision
|
ElementType, // Network precision
|
||||||
ngraph::helpers::InputLayerType>; // 'sequence_lengths' input type
|
InputLayerType>; // 'sequence_lengths' input type
|
||||||
|
|
||||||
class SequenceCPUTest : public testing::WithParamInterface<SeqParams>, virtual public ov::test::SubgraphBaseTest, public CPUTestsBase {
|
class SequenceCPUTest : public testing::WithParamInterface<SeqParams>, virtual public ov::test::SubgraphBaseTest, public CPUTestsBase {
|
||||||
public:
|
public:
|
||||||
@ -47,7 +50,7 @@ public:
|
|||||||
bool linearBeforeReset;
|
bool linearBeforeReset;
|
||||||
ov::op::RecurrentSequenceDirection direction;
|
ov::op::RecurrentSequenceDirection direction;
|
||||||
ElementType netPrecision;
|
ElementType netPrecision;
|
||||||
ngraph::helpers::InputLayerType seqInType;
|
InputLayerType seqInType;
|
||||||
|
|
||||||
std::tie(seqType, hidden_size, input_size, inShapeParams, activations, clip, linearBeforeReset, direction, netPrecision, seqInType) = obj.param;
|
std::tie(seqType, hidden_size, input_size, inShapeParams, activations, clip, linearBeforeReset, direction, netPrecision, seqInType) = obj.param;
|
||||||
|
|
||||||
@ -141,7 +144,7 @@ protected:
|
|||||||
weightShape.push_back(B_shape);
|
weightShape.push_back(B_shape);
|
||||||
|
|
||||||
ov::PartialShape seq_len_shape(std::vector<ov::Dimension>{bounds[batch_size_pos]});
|
ov::PartialShape seq_len_shape(std::vector<ov::Dimension>{bounds[batch_size_pos]});
|
||||||
if (seqInType == ngraph::helpers::InputLayerType::PARAMETER) {
|
if (seqInType == InputLayerType::PARAMETER) {
|
||||||
inputDynamicShapes.push_back(seq_len_shape);
|
inputDynamicShapes.push_back(seq_len_shape);
|
||||||
} else {
|
} else {
|
||||||
OPENVINO_ASSERT(seq_len_shape.is_static());
|
OPENVINO_ASSERT(seq_len_shape.is_static());
|
||||||
@ -160,7 +163,7 @@ protected:
|
|||||||
if (seqType == SEQ_TYPE::LSTM) {
|
if (seqType == SEQ_TYPE::LSTM) {
|
||||||
currTS.emplace_back(std::vector<size_t>{bs, numDirections, hidden_size});
|
currTS.emplace_back(std::vector<size_t>{bs, numDirections, hidden_size});
|
||||||
}
|
}
|
||||||
if (seqInType == ngraph::helpers::InputLayerType::PARAMETER) {
|
if (seqInType == InputLayerType::PARAMETER) {
|
||||||
currTS.emplace_back(std::vector<size_t>{bs});
|
currTS.emplace_back(std::vector<size_t>{bs});
|
||||||
}
|
}
|
||||||
targetStaticShapes.push_back(currTS);
|
targetStaticShapes.push_back(currTS);
|
||||||
@ -168,7 +171,7 @@ protected:
|
|||||||
|
|
||||||
// funciton creation
|
// funciton creation
|
||||||
std::vector<ov::element::Type> types(inputDynamicShapes.size(), netPrecision);
|
std::vector<ov::element::Type> types(inputDynamicShapes.size(), netPrecision);
|
||||||
if (seqInType == ngraph::helpers::InputLayerType::PARAMETER) {
|
if (seqInType == InputLayerType::PARAMETER) {
|
||||||
types.back() = ElementType::i64;
|
types.back() = ElementType::i64;
|
||||||
}
|
}
|
||||||
ov::ParameterVector params;
|
ov::ParameterVector params;
|
||||||
@ -190,45 +193,45 @@ protected:
|
|||||||
|
|
||||||
std::shared_ptr<ov::Node> seq_node;
|
std::shared_ptr<ov::Node> seq_node;
|
||||||
if (seqType == SEQ_TYPE::GRU) {
|
if (seqType == SEQ_TYPE::GRU) {
|
||||||
seq_node = ngraph::builder::makeGRU(inputs,
|
seq_node = utils::make_gru(
|
||||||
weightShape,
|
inputs,
|
||||||
hidden_size,
|
weightShape,
|
||||||
activations,
|
hidden_size,
|
||||||
{},
|
activations,
|
||||||
{},
|
{},
|
||||||
clip,
|
{},
|
||||||
linearBeforeReset,
|
clip,
|
||||||
true,
|
linearBeforeReset,
|
||||||
direction,
|
true,
|
||||||
(seqInType == ngraph::helpers::InputLayerType::CONSTANT ?
|
direction,
|
||||||
ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST :
|
(seqInType == InputLayerType::CONSTANT ? SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST
|
||||||
ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM));
|
: SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM));
|
||||||
} else if (seqType == SEQ_TYPE::LSTM) {
|
} else if (seqType == SEQ_TYPE::LSTM) {
|
||||||
seq_node = ngraph::builder::makeLSTM(inputs,
|
seq_node = utils::make_lstm(
|
||||||
weightShape,
|
inputs,
|
||||||
hidden_size,
|
weightShape,
|
||||||
activations,
|
hidden_size,
|
||||||
{},
|
activations,
|
||||||
{},
|
{},
|
||||||
clip,
|
{},
|
||||||
true,
|
clip,
|
||||||
direction,
|
true,
|
||||||
(seqInType == ngraph::helpers::InputLayerType::CONSTANT ?
|
direction,
|
||||||
ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST :
|
(seqInType == InputLayerType::CONSTANT ? SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST
|
||||||
ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM));
|
: SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM));
|
||||||
} else if (seqType == SEQ_TYPE::RNN) {
|
} else if (seqType == SEQ_TYPE::RNN) {
|
||||||
seq_node = ngraph::builder::makeRNN(inputs,
|
seq_node = utils::make_rnn(
|
||||||
weightShape,
|
inputs,
|
||||||
hidden_size,
|
weightShape,
|
||||||
activations,
|
hidden_size,
|
||||||
{},
|
activations,
|
||||||
{},
|
{},
|
||||||
clip,
|
{},
|
||||||
true,
|
clip,
|
||||||
direction,
|
true,
|
||||||
(seqInType == ngraph::helpers::InputLayerType::CONSTANT ?
|
direction,
|
||||||
ngraph::helpers::SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST :
|
(seqInType == InputLayerType::CONSTANT ? SequenceTestsMode::CONVERT_TO_TI_MAX_SEQ_LEN_CONST
|
||||||
ngraph::helpers::SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM));
|
: SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_PARAM));
|
||||||
} else {
|
} else {
|
||||||
OPENVINO_THROW("Unsupported seq type");
|
OPENVINO_THROW("Unsupported seq type");
|
||||||
}
|
}
|
||||||
@ -254,7 +257,7 @@ protected:
|
|||||||
const size_t batchSize = targetInputStaticShapes[0][1];
|
const size_t batchSize = targetInputStaticShapes[0][1];
|
||||||
const int64_t maxSeqLen = targetInputStaticShapes[0][0];
|
const int64_t maxSeqLen = targetInputStaticShapes[0][0];
|
||||||
|
|
||||||
if (seqInType == ngraph::helpers::InputLayerType::PARAMETER) {
|
if (seqInType == InputLayerType::PARAMETER) {
|
||||||
const auto& funcInputs = function->inputs();
|
const auto& funcInputs = function->inputs();
|
||||||
const auto& seqLenInput = inputs.find(funcInputs[seqLengthInIdx].get_node_shared_ptr());
|
const auto& seqLenInput = inputs.find(funcInputs[seqLengthInIdx].get_node_shared_ptr());
|
||||||
if (seqLenInput == inputs.end())
|
if (seqLenInput == inputs.end())
|
||||||
@ -266,7 +269,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ngraph::helpers::InputLayerType seqInType;
|
InputLayerType seqInType;
|
||||||
size_t seqLengthInIdx = 2;
|
size_t seqLengthInIdx = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -326,7 +329,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_dynamic_lstm_rnn, SequenceCPUTest
|
|||||||
::testing::ValuesIn(linearBeforeReset),
|
::testing::ValuesIn(linearBeforeReset),
|
||||||
::testing::ValuesIn(direction),
|
::testing::ValuesIn(direction),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER)),
|
::testing::Values(InputLayerType::PARAMETER)),
|
||||||
SequenceCPUTest::getTestCaseName);
|
SequenceCPUTest::getTestCaseName);
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_dynamic_gru, SequenceCPUTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_dynamic_gru, SequenceCPUTest,
|
||||||
@ -339,7 +342,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_dynamic_gru, SequenceCPUTest,
|
|||||||
::testing::ValuesIn(linearBeforeReset),
|
::testing::ValuesIn(linearBeforeReset),
|
||||||
::testing::ValuesIn(direction),
|
::testing::ValuesIn(direction),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER)),
|
::testing::Values(InputLayerType::PARAMETER)),
|
||||||
SequenceCPUTest::getTestCaseName);
|
SequenceCPUTest::getTestCaseName);
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_static_gru, SequenceCPUTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_static_gru, SequenceCPUTest,
|
||||||
@ -352,7 +355,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_static_gru, SequenceCPUTest,
|
|||||||
::testing::ValuesIn(linearBeforeReset),
|
::testing::ValuesIn(linearBeforeReset),
|
||||||
::testing::ValuesIn(direction),
|
::testing::ValuesIn(direction),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT)),
|
::testing::Values(InputLayerType::CONSTANT)),
|
||||||
SequenceCPUTest::getTestCaseName);
|
SequenceCPUTest::getTestCaseName);
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_static_rnn_lstm, SequenceCPUTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_static_rnn_lstm, SequenceCPUTest,
|
||||||
@ -365,7 +368,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_SequenceCPUTest_static_rnn_lstm, SequenceCPUTest,
|
|||||||
::testing::ValuesIn(linearBeforeReset),
|
::testing::ValuesIn(linearBeforeReset),
|
||||||
::testing::ValuesIn(direction),
|
::testing::ValuesIn(direction),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT)),
|
::testing::Values(InputLayerType::CONSTANT)),
|
||||||
SequenceCPUTest::getTestCaseName);
|
SequenceCPUTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace SubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
@ -2,14 +2,12 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
#include "common_test_utils/ov_tensor_utils.hpp"
|
||||||
#include "ov_models/builders.hpp"
|
#include "ov_models/builders.hpp"
|
||||||
#include <common_test_utils/ov_tensor_utils.hpp>
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||||
#include "functional_test_utils/skip_tests_config.hpp"
|
|
||||||
|
|
||||||
using namespace ov::test;
|
namespace ov {
|
||||||
|
namespace test {
|
||||||
namespace SubgraphTestsDefinitions {
|
|
||||||
|
|
||||||
class StaticZeroDims : public SubgraphBaseTest {
|
class StaticZeroDims : public SubgraphBaseTest {
|
||||||
protected:
|
protected:
|
||||||
@ -20,26 +18,26 @@ protected:
|
|||||||
|
|
||||||
init_input_shapes({inputShapes});
|
init_input_shapes({inputShapes});
|
||||||
|
|
||||||
auto ngPrc = ngraph::element::f32;
|
auto ngPrc = ov::element::f32;
|
||||||
ov::ParameterVector inputParams;
|
ov::ParameterVector inputParams;
|
||||||
for (auto&& shape : inputDynamicShapes) {
|
for (auto&& shape : inputDynamicShapes) {
|
||||||
inputParams.push_back(std::make_shared<ov::op::v0::Parameter>(ngPrc, shape));
|
inputParams.push_back(std::make_shared<ov::op::v0::Parameter>(ngPrc, shape));
|
||||||
}
|
}
|
||||||
auto splitAxisOp = std::make_shared<ngraph::opset3::Constant>(ngraph::element::i64, ngraph::Shape{}, std::vector<int64_t>{0});
|
auto splitAxisOp = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{}, std::vector<int64_t>{0});
|
||||||
std::vector<int> splitLenght = {1, 0, 6};
|
std::vector<int> splitLenght = {1, 0, 6};
|
||||||
auto splitLengthsOp = std::make_shared<ngraph::opset3::Constant>(ngraph::element::i32, ngraph::Shape{splitLenght.size()}, splitLenght);
|
auto splitLengthsOp = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{splitLenght.size()}, splitLenght);
|
||||||
auto varSplit = std::make_shared<ngraph::opset3::VariadicSplit>(inputParams[0], splitAxisOp, splitLengthsOp);
|
auto varSplit = std::make_shared<ov::op::v1::VariadicSplit>(inputParams[0], splitAxisOp, splitLengthsOp);
|
||||||
|
|
||||||
auto relu1 = std::make_shared<ngraph::opset5::Relu>(varSplit->output(0));
|
auto relu1 = std::make_shared<ov::op::v0::Relu>(varSplit->output(0));
|
||||||
|
|
||||||
auto numInRoi = ngraph::builder::makeConstant(ngPrc, {0}, std::vector<float>{}, false);
|
auto numInRoi = ngraph::builder::makeConstant(ngPrc, {0}, std::vector<float>{}, false);
|
||||||
auto expDet = std::make_shared<ov::op::v6::ExperimentalDetectronTopKROIs>(varSplit->output(1), numInRoi, 10);
|
auto expDet = std::make_shared<ov::op::v6::ExperimentalDetectronTopKROIs>(varSplit->output(1), numInRoi, 10);
|
||||||
auto relu2 = std::make_shared<ngraph::opset5::Relu>(expDet);
|
auto relu2 = std::make_shared<ov::op::v0::Relu>(expDet);
|
||||||
|
|
||||||
auto relu3 = std::make_shared<ngraph::opset5::Relu>(varSplit->output(2));
|
auto relu3 = std::make_shared<ov::op::v0::Relu>(varSplit->output(2));
|
||||||
|
|
||||||
ngraph::NodeVector results{relu1, relu2, relu3};
|
ov::NodeVector results{relu1, relu2, relu3};
|
||||||
function = std::make_shared<ngraph::Function>(results, inputParams, "StaticZeroDims");
|
function = std::make_shared<ov::Model>(results, inputParams, "StaticZeroDims");
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare(const std::vector<ov::Tensor> &expected, const std::vector<ov::Tensor> &actual) override {
|
void compare(const std::vector<ov::Tensor> &expected, const std::vector<ov::Tensor> &actual) override {
|
||||||
@ -59,4 +57,5 @@ TEST_F(StaticZeroDims, smoke_CompareWithRefs) {
|
|||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace SubgraphTestsDefinitions
|
} // namespace test
|
||||||
|
} // namespace ov
|
||||||
|
Loading…
Reference in New Issue
Block a user