Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up of tests/ov_helpers leftovers #21416

Merged
merged 17 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ std::shared_ptr<ngraph::Function> getFunction2() {

auto in2add = ngraph::builder::makeConstant(ngPrc, {1, 2, 1, 1}, std::vector<float>{}, true);
auto add = ngraph::builder::makeEltwise(split->output(0), in2add, ngraph::helpers::EltwiseTypes::ADD);
auto relu1 = std::make_shared<ngraph::opset1::Relu>(add);
auto relu1 = std::make_shared<ov::op::v0::Relu>(add);

auto in2mult = ngraph::builder::makeConstant(ngPrc, {1, 2, 1, 1}, std::vector<float>{}, true);
auto mult = ngraph::builder::makeEltwise(split->output(1), in2mult, ngraph::helpers::EltwiseTypes::MULTIPLY);
auto relu2 = std::make_shared<ngraph::opset1::Relu>(mult);
auto relu2 = std::make_shared<ov::op::v0::Relu>(mult);

auto concat = std::make_shared<ngraph::opset1::Concat>(ngraph::OutputVector{relu1->output(0), relu2->output(0)}, 3);
auto concat = std::make_shared<ov::op::v0::Concat>(ngraph::OutputVector{relu1->output(0), relu2->output(0)}, 3);
concat->get_output_tensor(0).set_names({"concat"});

return std::make_shared<ngraph::Function>(concat, params, "SplitAddConcat");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ std::shared_ptr<ngraph::Function> getFunction1() {

auto in2add = ngraph::builder::makeConstant(ngPrc, {1, 4, 1, 1}, std::vector<float>{}, true);
auto add = ngraph::builder::makeEltwise(params[0], in2add, ngraph::helpers::EltwiseTypes::ADD);
auto relu1 = std::make_shared<ngraph::opset1::Relu>(add->output(0));
auto relu1 = std::make_shared<ov::op::v0::Relu>(add->output(0));
relu1->get_output_tensor(0).set_names({"relu1"});
auto relu2 = std::make_shared<ngraph::opset1::Relu>(add->output(0));
auto relu2 = std::make_shared<ov::op::v0::Relu>(add->output(0));
relu2->get_output_tensor(0).set_names({"relu2"});

ngraph::NodeVector results{relu1, relu2};
Expand All @@ -51,13 +51,13 @@ std::shared_ptr<ngraph::Function> getFunction2() {

auto in2add = ngraph::builder::makeConstant(ngPrc, {1, 2, 1, 1}, std::vector<float>{}, true);
auto add = ngraph::builder::makeEltwise(split->output(0), in2add, ngraph::helpers::EltwiseTypes::ADD);
auto relu1 = std::make_shared<ngraph::opset1::Relu>(add);
auto relu1 = std::make_shared<ov::op::v0::Relu>(add);

auto in2mult = ngraph::builder::makeConstant(ngPrc, {1, 2, 1, 1}, std::vector<float>{}, true);
auto mult = ngraph::builder::makeEltwise(split->output(1), in2mult, ngraph::helpers::EltwiseTypes::MULTIPLY);
auto relu2 = std::make_shared<ngraph::opset1::Relu>(mult);
auto relu2 = std::make_shared<ov::op::v0::Relu>(mult);

auto concat = std::make_shared<ngraph::opset1::Concat>(ngraph::OutputVector{relu1->output(0), relu2->output(0)}, 3);
auto concat = std::make_shared<ov::op::v0::Concat>(ngraph::OutputVector{relu1->output(0), relu2->output(0)}, 3);
concat->get_output_tensor(0).set_names({"concat"});

return std::make_shared<ngraph::Function>(concat, params, "SplitAddConcat");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,37 @@ namespace {
};

static std::shared_ptr<ngraph::Function> simple_function_non_max_suppression_internal(ngraph::element::Type, size_t) {
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
auto max_output_boxes_per_class = opset1::Constant::create(element::i32, Shape{1}, {10});
auto iou_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.75});
auto score_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.7});
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
auto max_output_boxes_per_class = ov::op::v0::Constant::create(element::i32, Shape{1}, {10});
auto iou_threshold = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.75});
auto score_threshold = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.7});
auto nms = std::make_shared<ov::op::internal::NonMaxSuppressionIEInternal>(boxes, scores, max_output_boxes_per_class,
iou_threshold, score_threshold, 0, true, element::i32);
auto res = std::make_shared<ngraph::opset6::Result>(nms);
auto res = std::make_shared<ov::op::v0::Result>(nms);
auto func = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
return func;
}

static std::shared_ptr<ngraph::Function> simple_function_matrix_nms_internal(ngraph::element::Type, size_t) {
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
ov::op::v8::MatrixNms::Attributes attr;
// convert_precision does not support internal op 'NmsStaticShapeIE'
attr.output_type = element::i32;
auto nms = std::make_shared<ov::op::internal::NmsStaticShapeIE<ov::op::v8::MatrixNms>>(boxes, scores, attr);
auto res = std::make_shared<ngraph::opset6::Result>(nms);
auto res = std::make_shared<ov::op::v0::Result>(nms);
auto func = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
return func;
}

static std::shared_ptr<ngraph::Function> simple_function_multiclass_nms_internal(ngraph::element::Type, size_t) {
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
op::util::MulticlassNmsBase::Attributes attr;
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
ov::op::util::MulticlassNmsBase::Attributes attr;
attr.output_type = element::i32;
auto nms = std::make_shared<ov::op::internal::MulticlassNmsIEInternal>(boxes, scores, attr);
auto res = std::make_shared<ngraph::opset6::Result>(nms);
auto res = std::make_shared<ov::op::v0::Result>(nms);
auto func = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
return func;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inline InferenceEngine::CNNNetwork getTargetNetwork() {
auto input = std::make_shared<op::v0::Parameter>(type, shape);
auto mem_i = std::make_shared<op::v0::Constant>(type, shape, 0);
auto mem_r = std::make_shared<op::v3::ReadValue>(mem_i, "id");
auto mul = std::make_shared<ngraph::op::v1::Multiply>(mem_r, input);
auto mul = std::make_shared<ov::op::v1::Multiply>(mem_r, input);
auto mem_w = std::make_shared<op::v3::Assign>(mul, "id");
auto sigm = std::make_shared<ngraph::op::Sigmoid>(mul);
mem_r->set_friendly_name("Memory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{},
std::make_shared<ngraph::opset1::Constant>(ov::element::u8, ov::Shape{1, 3, 16, 16}, std::vector<float>(3 * 16 * 16, 1.0)),
std::make_shared<ov::op::v0::Constant>(ov::element::u8, ov::Shape{1, 3, 16, 16}, std::vector<float>(3 * 16 * 16, 1.0)),
{},
{
{ ov::element::f16 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@

using namespace LayerTestsDefinitions;
using namespace InferenceEngine::details;
using namespace ngraph::opset1;

namespace {
const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f32,
// ngraph::element::f16
};

const std::vector<DepthToSpace::DepthToSpaceMode> modes = {
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
DepthToSpace::DepthToSpaceMode::DEPTH_FIRST
const std::vector<ov::op::v0::DepthToSpace::DepthToSpaceMode> modes = {
ov::op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
ov::op::v0::DepthToSpace::DepthToSpaceMode::DEPTH_FIRST
};

const std::vector<ngraph::PartialShape> inputShapesBS2 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const std::vector<ov::element::Type> model_types = {
ov::element::i16,
};

const std::vector<DepthToSpace::DepthToSpaceMode> modes = {
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
DepthToSpace::DepthToSpaceMode::DEPTH_FIRST
const std::vector<ov::op::v0::DepthToSpace::DepthToSpaceMode> modes = {
ov::op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
ov::op::v0::DepthToSpace::DepthToSpaceMode::DEPTH_FIRST
};

const std::vector<std::vector<ov::Shape>> input_shapes_bs2_static = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ class PSROIPoolingLayerCPUTest : public testing::WithParamInterface<PSROIPooling
auto coords = ngraph::builder::makeConstant<float>(ngraph::element::f32, proposalShape, proposal);
ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ov::Shape(featureMapShape))};

auto psroi = std::make_shared<ngraph::op::v0::PSROIPooling>(params[0], coords, outputDim, groupSize,
auto psroi = std::make_shared<ov::op::v0::PSROIPooling>(params[0], coords, outputDim, groupSize,
spatialScale, spatialBinsX, spatialBinsY, mode);
psroi->get_rt_info() = getCPUInfo();
selectedType = getPrimitiveType() + "_" + inPrc.name();

threshold = 1e-2f;
const ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(psroi)};
const ngraph::ResultVector results{std::make_shared<ov::op::v0::Result>(psroi)};
function = std::make_shared<ngraph::Function>(results, params, "PSROIPooling");
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@
// step = std::get<2>(rangeInputs);
// auto ngOutPr = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(outPrc);
// auto ngNetPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inPrc);
// auto startPar = std::make_shared<ngraph::opset5::Parameter>(ngNetPrc, ngraph::Shape{});
// auto stopPar = std::make_shared<ngraph::opset5::Parameter>(ngNetPrc, ngraph::Shape{});
// auto stepPar = std::make_shared<ngraph::opset5::Parameter>(ngNetPrc, ngraph::Shape{});
// auto range = std::make_shared<ngraph::opset4::Range>(startPar, stopPar, stepPar, ngOutPr);
// auto startPar = std::make_shared<ov::op::v0::Parameter>(ngNetPrc, ngraph::Shape{});
// auto stopPar = std::make_shared<ov::op::v0::Parameter>(ngNetPrc, ngraph::Shape{});
// auto stepPar = std::make_shared<ov::op::v0::Parameter>(ngNetPrc, ngraph::Shape{});
// auto range = std::make_shared<ov::op::v4::Range>(startPar, stopPar, stepPar, ngOutPr);
// range->get_rt_info() = getCPUInfo();
// selectedType = std::string("ref_any_") + (inPrc == outPrc ? inPrc.name() : "FP32");
// startPar->set_friendly_name("start");
// stopPar->set_friendly_name("stop");
// stepPar->set_friendly_name("step");
//
// const ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(range)};
// const ngraph::ResultVector results{std::make_shared<ov::op::v0::Result>(range)};
// function = std::make_shared<ngraph::Function>(results, ngraph::ParameterVector {
// startPar, stopPar, stepPar}, "Range");
// functionRefs = ngraph::clone_function(*function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ConcatSDPTest : public testing::WithParamInterface<ConcatSDPTestParams>, v
auto concatV = std::make_shared<ov::op::v0::Concat>(OutputVector{pastv, inputParams[2]}, 2);
auto sdp = std::make_shared<ov::opset13::ScaledDotProductAttention>(inputParams[0], concatK, concatV, false);
sdp->set_friendly_name("mha");
auto add = std::make_shared<op::v1::Add>(sdp, op::v0::Constant::create(inType, {1}, {1.0f}));
auto add = std::make_shared<ov::op::v1::Add>(sdp, op::v0::Constant::create(inType, {1}, {1.0f}));
auto pastk_assign = std::make_shared<op::v6::Assign>(concatK, var_k);
auto pastv_assign = std::make_shared<op::v6::Assign>(concatV, var_v);
pastk_assign->set_friendly_name("pastk_w");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,29 @@ static std::shared_ptr<ov::Model> buildROPE_Llama2(const int batch,
auto Constant585 = cos_sin_cache[1];

// concat KV length
auto transpose_Transpose = makeOP<opset1::Transpose>({input, {0, 2, 1, 3}});
auto slice_Unsqueeze_426 = makeOP<opset1::Unsqueeze>({pos_id_end, 0});
auto ScatterUpdate_152236 = makeOP<opset3::ScatterUpdate>({{0, 0, 0}, {2}, slice_Unsqueeze_426, {0}});
auto slice_Slice = makeOP<opset1::StridedSlice>({Constant582, {0, 0, 0}, ScatterUpdate_152236, {1, 1, 1}},
auto transpose_Transpose = makeOP<ov::op::v1::Transpose>({input, {0, 2, 1, 3}});
auto slice_Unsqueeze_426 = makeOP<ov::op::v0::Unsqueeze>({pos_id_end, 0});
auto ScatterUpdate_152236 = makeOP<ov::op::v3::ScatterUpdate>({{0, 0, 0}, {2}, slice_Unsqueeze_426, {0}});
auto slice_Slice = makeOP<ov::op::v1::StridedSlice>({Constant582, {0, 0, 0}, ScatterUpdate_152236, {1, 1, 1}},
{{"begin_mask", {1, 1, 0}},
{"end_mask", {1, 1, 0}},
{"new_axis_mask", {}},
{"shrink_axis_mask", {}},
{"ellipsis_mask", {}}});
auto squeeze_Squeeze = makeOP<opset1::Squeeze>({slice_Slice, 1});
auto squeeze_Squeeze_435 = makeOP<opset1::Squeeze>({squeeze_Squeeze, 0});
auto index_441_Gather = makeOP<opset8::Gather>({squeeze_Squeeze_435, pos_ids, 0}, {{"batch_dims", 0}});
auto unsqueeze_Unsqueeze = makeOP<opset1::Unsqueeze>({index_441_Gather, 1});
auto squeeze_Squeeze = makeOP<ov::op::v0::Squeeze>({slice_Slice, 1});
auto squeeze_Squeeze_435 = makeOP<ov::op::v0::Squeeze>({squeeze_Squeeze, 0});
auto index_441_Gather = makeOP<ov::op::v8::Gather>({squeeze_Squeeze_435, pos_ids, 0}, {{"batch_dims", 0}});
auto unsqueeze_Unsqueeze = makeOP<ov::op::v0::Unsqueeze>({index_441_Gather, 1});
auto mul_Multiply =
makeOP<opset1::Multiply>({transpose_Transpose, unsqueeze_Unsqueeze}, {{"auto_broadcast", "numpy"}});
auto size_ShapeOf_448 = makeOP<opset3::ShapeOf>({transpose_Transpose}, {{"output_type", "i32"}});
auto size_Gather_450 = makeOP<opset8::Gather>({size_ShapeOf_448, 3, 0}, {{"batch_dims", 0}});
makeOP<ov::op::v1::Multiply>({transpose_Transpose, unsqueeze_Unsqueeze}, {{"auto_broadcast", "numpy"}});
auto size_ShapeOf_448 = makeOP<ov::op::v3::ShapeOf>({transpose_Transpose}, {{"output_type", "i32"}});
auto size_Gather_450 = makeOP<ov::op::v8::Gather>({size_ShapeOf_448, 3, 0}, {{"batch_dims", 0}});
auto floor_divide_Divide =
makeOP<opset1::Divide>({size_Gather_450, 2}, {{"auto_broadcast", "numpy"}, {"m_pythondiv", true}});
auto floor_divide_Floor = makeOP<opset1::Floor>({floor_divide_Divide});
auto slice_Unsqueeze_452 = makeOP<opset1::Unsqueeze>({floor_divide_Floor, 0});
auto ScatterUpdate_152312 = makeOP<opset3::ScatterUpdate>({{0, 0, 0, 0}, {3}, slice_Unsqueeze_452, {0}});
auto slice_Slice_459 = makeOP<opset1::StridedSlice>(
makeOP<ov::op::v1::Divide>({size_Gather_450, 2}, {{"auto_broadcast", "numpy"}, {"m_pythondiv", true}});
auto floor_divide_Floor = makeOP<ov::op::v0::Floor>({floor_divide_Divide});
auto slice_Unsqueeze_452 = makeOP<ov::op::v0::Unsqueeze>({floor_divide_Floor, 0});
auto ScatterUpdate_152312 = makeOP<ov::op::v3::ScatterUpdate>({{0, 0, 0, 0}, {3}, slice_Unsqueeze_452, {0}});
auto slice_Slice_459 = makeOP<ov::op::v1::StridedSlice>(
{transpose_Transpose, ScatterUpdate_152312, {0ll, 0ll, 0ll, LLONG_MAX}, {1, 1, 1, 1}},
{{"begin_mask", {1, 1, 1, 0}},
{"end_mask", {1, 1, 1, 0}},
Expand All @@ -102,30 +102,30 @@ static std::shared_ptr<ov::Model> buildROPE_Llama2(const int batch,
1,
}),
{-1.000000f});
auto neg_Multiply = makeOP<opset1::Multiply>({slice_Slice_459, Constant_182988}, {{"auto_broadcast", "numpy"}});
auto ScatterUpdate_152368 = makeOP<opset3::ScatterUpdate>({{0, 0, 0, 0}, {3}, slice_Unsqueeze_452, {0}});
auto neg_Multiply = makeOP<ov::op::v1::Multiply>({slice_Slice_459, Constant_182988}, {{"auto_broadcast", "numpy"}});
auto ScatterUpdate_152368 = makeOP<ov::op::v3::ScatterUpdate>({{0, 0, 0, 0}, {3}, slice_Unsqueeze_452, {0}});
auto slice_Slice2 =
makeOP<opset1::StridedSlice>({transpose_Transpose, {0, 0, 0, 0}, ScatterUpdate_152368, {1, 1, 1, 1}},
makeOP<ov::op::v1::StridedSlice>({transpose_Transpose, {0, 0, 0, 0}, ScatterUpdate_152368, {1, 1, 1, 1}},
{{"begin_mask", {1, 1, 1, 0}},
{"end_mask", {1, 1, 1, 0}},
{"new_axis_mask", {}},
{"shrink_axis_mask", {}},
{"ellipsis_mask", {}}});
auto cat_Concat = makeOP<opset1::Concat>({neg_Multiply, slice_Slice2}, {{"axis", -1}});
auto ScatterUpdate_152421 = makeOP<opset3::ScatterUpdate>({{0, 0, 0}, {2}, slice_Unsqueeze_426, {0}});
auto slice_Slice_433 = makeOP<opset1::StridedSlice>({Constant585, {0, 0, 0}, ScatterUpdate_152421, {1, 1, 1}},
auto cat_Concat = makeOP<ov::op::v0::Concat>({neg_Multiply, slice_Slice2}, {{"axis", -1}});
auto ScatterUpdate_152421 = makeOP<ov::op::v3::ScatterUpdate>({{0, 0, 0}, {2}, slice_Unsqueeze_426, {0}});
auto slice_Slice_433 = makeOP<ov::op::v1::StridedSlice>({Constant585, {0, 0, 0}, ScatterUpdate_152421, {1, 1, 1}},
{{"begin_mask", {1, 1, 0}},
{"end_mask", {1, 1, 0}},
{"new_axis_mask", {}},
{"shrink_axis_mask", {}},
{"ellipsis_mask", {}}});
auto squeeze_Squeeze_436 = makeOP<opset1::Squeeze>({slice_Slice_433, 1});
auto squeeze_Squeeze_437 = makeOP<opset1::Squeeze>({squeeze_Squeeze_436, 0});
auto index_446_Gather = makeOP<opset8::Gather>({squeeze_Squeeze_437, pos_ids, 0}, {{"batch_dims", 0}});
auto unsqueeze_Unsqueeze_447 = makeOP<opset1::Unsqueeze>({index_446_Gather, 1});
auto squeeze_Squeeze_436 = makeOP<ov::op::v0::Squeeze>({slice_Slice_433, 1});
auto squeeze_Squeeze_437 = makeOP<ov::op::v0::Squeeze>({squeeze_Squeeze_436, 0});
auto index_446_Gather = makeOP<ov::op::v8::Gather>({squeeze_Squeeze_437, pos_ids, 0}, {{"batch_dims", 0}});
auto unsqueeze_Unsqueeze_447 = makeOP<ov::op::v0::Unsqueeze>({index_446_Gather, 1});
auto mul_Multiply_463 =
makeOP<opset1::Multiply>({cat_Concat, unsqueeze_Unsqueeze_447}, {{"auto_broadcast", "numpy"}});
auto add_Add = makeOP<opset1::Add>({mul_Multiply, mul_Multiply_463}, {{"auto_broadcast", "numpy"}});
makeOP<ov::op::v1::Multiply>({cat_Concat, unsqueeze_Unsqueeze_447}, {{"auto_broadcast", "numpy"}});
auto add_Add = makeOP<ov::op::v1::Add>({mul_Multiply, mul_Multiply_463}, {{"auto_broadcast", "numpy"}});

return std::make_shared<ov::Model>(ov::NodeVector{add_Add}, ov::ParameterVector{input, pos_id_end, pos_ids});
}
Expand Down
Loading
Loading