Refactor ngraph builders 3 (#21077)

* Remove and deprecate makeSqueezeUnsqueeze

* Remove and deprecate  makeMinMax makeProposal

* Remove makeCumSum makeSelect builders

* Remove makeSpaceToDepth builder

* Remove makeShuffleChannels builder

* Remove makeMatMul builder
This commit is contained in:
Oleg Pipikin 2023-11-15 07:41:45 +01:00 committed by GitHub
parent c360de0f07
commit 534ec2e9ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 104 additions and 179 deletions

View File

@ -42,7 +42,7 @@ TEST_F(TypeRelaxedThreading, TypeRelaxedCloning) {
auto inp2 = std::make_shared<op::v0::Parameter>(element::i8, PartialShape{-1, -1, -1, -1});
auto matMulRelaxed = std::make_shared<ov::op::TypeRelaxed<ov::op::v0::MatMul>>(
*as_type_ptr<op::v0::MatMul>(ngraph::builder::makeMatMul(inp1_f32, inp2_f32, false, false)),
*std::make_shared<ov::op::v0::MatMul>(inp1_f32, inp2_f32, false, false),
element::f32);
auto matMul = matMulRelaxed->clone_with_new_inputs({inp1, inp2});

View File

@ -25,7 +25,7 @@ std::shared_ptr<ov::Model> MakeMatMulModel() {
ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape(input_shape))};
auto matmul_const = ngraph::builder::makeConstant(precision, {4096, 1024}, std::vector<float>{}, true);
auto matmul = ngraph::builder::makeMatMul(params[0], matmul_const);
auto matmul = std::make_shared<ov::op::v0::MatMul>(params[0], matmul_const);
auto add_const = ngraph::builder::makeConstant(precision, {1, 1024}, std::vector<float>{}, true);
auto add = ngraph::builder::makeEltwise(matmul, add_const, ngraph::helpers::EltwiseTypes::ADD);

View File

@ -133,7 +133,7 @@ void MatMulLayerCPUTest::SetUp() {
params.push_back(std::dynamic_pointer_cast<opset1::Parameter>(matrixB));
}
auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<opset1::Parameter>(params));
auto matMul = builder::makeMatMul(paramOuts[0], matrixB, transpA, transpB);
auto matMul = std::make_shared<ov::op::v0::MatMul>(paramOuts[0], matrixB, transpA, transpB);
function = makeNgraphFunction(netType, params, matMul, cpuNodeType);
checkFusingPosition = false;
}

View File

@ -62,7 +62,7 @@ protected:
params.push_back(std::make_shared<ov::op::v0::Parameter>(inType, shape));
}
auto axisNode = ngraph::opset1::Constant::create(ngraph::element::i32, ngraph::Shape{}, std::vector<int64_t>{axis})->output(0);
auto cumSum = ngraph::builder::makeCumSum(params[0], axisNode, exclusive, reverse);
auto cumSum = std::make_shared<ov::op::v0::CumSum>(params[0], axisNode, exclusive, reverse);
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{ cumSum }, params, "CumSumLayerCPUTest");
functionRefs = ngraph::clone_function(*function);

View File

@ -133,7 +133,7 @@ protected:
auto matrixBFP32 = builder::makeDynamicInputLayer(element::f32, helpers::InputLayerType::CONSTANT, inShapeB);
auto matMulRelaxed = std::make_shared<ov::op::TypeRelaxed<opset3::MatMul>>(
*as_type_ptr<opset3::MatMul>(builder::makeMatMul(inputParamsFP32, matrixBFP32, transpose_a, transpose_b)),
*std::make_shared<ov::op::v0::MatMul>(inputParamsFP32, matrixBFP32, transpose_a, transpose_b),
element::f32);
auto matrixB = ngraph::builder::makeConstant<int8_t>(weiType, inShapeB.get_shape(), weiData);

View File

@ -69,8 +69,7 @@ protected:
for (auto&& shape : inputDynamicShapes) {
params.push_back(std::make_shared<ov::op::v0::Parameter>(inType, shape));
}
auto shuffleChannels = std::dynamic_pointer_cast<ngraph::opset3::ShuffleChannels>(
ngraph::builder::makeShuffleChannels(params[0], axis, group));
auto shuffleChannels = std::make_shared<ov::op::v0::ShuffleChannels>(params[0], axis, group);
function = makeNgraphFunction(inType, params, shuffleChannels, "ShuffleChannels");
}
};

View File

@ -77,7 +77,7 @@ protected:
for (auto&& shape : inputDynamicShapes) {
params.push_back(std::make_shared<ov::op::v0::Parameter>(inType, shape));
}
auto d2s = ngraph::builder::makeSpaceToDepth(params[0], mode, blockSize);
auto d2s = std::make_shared<ov::op::v0::SpaceToDepth> (params[0], mode, blockSize);
function = makeNgraphFunction(inType, params, d2s, "SpaceToDepthCPU");
}
};

View File

@ -56,7 +56,7 @@ protected:
const auto ngPrec = element::f32;
ov::ParameterVector inputParams{std::make_shared<ov::op::v0::Parameter>(ngPrec, ov::Shape(inShapes.first)),
std::make_shared<ov::op::v0::Parameter>(ngPrec, ov::Shape(inShapes.second))};
const auto matMul = builder::makeMatMul(inputParams[0], inputParams[1], false, false);
const auto matMul = std::make_shared<ov::op::v0::MatMul>(inputParams[0], inputParams[1], false, false);
selectedType = makeSelectedTypeStr(with_cpu_x86_avx512_core() ? "brgemm_avx512" : "jit_gemm", ngPrec);

View File

@ -48,7 +48,7 @@ protected:
auto mmConst = ngraph::opset5::Constant::create(ngraph::element::f32, mmShape2, mmInData);
ov::ParameterVector mmParams {std::make_shared<ov::op::v0::Parameter>(ngPrec, mmShape)};
const auto mm = builder::makeMatMul(mmParams[0], mmConst, false, false);
const auto mm = std::make_shared<ov::op::v0::MatMul>(mmParams[0], mmConst, false, false);
auto sum = ngraph::builder::makeEltwise(constShift, mm, ngraph::helpers::EltwiseTypes::ADD);
auto fq = ngraph::builder::makeFakeQuantize(sum, ngraph::element::f32, 256, {}, {-8.0f}, {7.0f}, {-8.0f}, {7.0f});

View File

@ -55,10 +55,10 @@ protected:
if (rank == 3) bcastTo3D(fcWeightsShape);
auto fc1secondInput = builder::makeInputLayer(ngPrec, helpers::InputLayerType::CONSTANT, fcWeightsShape);
const auto fc1 = builder::makeMatMul(split->output(0), fc1secondInput, false, false);
const auto fc1 = std::make_shared<ov::op::v0::MatMul>(split->output(0), fc1secondInput, false, false);
auto fc2secondInputB = builder::makeInputLayer(ngPrec, helpers::InputLayerType::CONSTANT, fcWeightsShape);
const auto fc2 = builder::makeMatMul(split->output(1), fc2secondInputB, false, false);
const auto fc2 = std::make_shared<ov::op::v0::MatMul>(split->output(1), fc2secondInputB, false, false);
const auto fcConcatAxis = rank == 3 ? 1 : 0;
const auto concatMatMuls = builder::makeConcat({fc1, fc2}, fcConcatAxis);

View File

@ -216,7 +216,7 @@ protected:
}
expectedWeiConstElemType = weiConstElemType;
auto matMul = builder::makeMatMul(params[0], inputB, transpA, transpB);
auto matMul = std::make_shared<ov::op::v0::MatMul>(params[0], inputB, transpA, transpB);
function = CPUTestsBase::makeNgraphFunction(netType, params, matMul, cpuNodeType);
}
@ -501,8 +501,8 @@ protected:
// In this test, convert must be folded on the ngraph side, so the constant with fp32 precision is expected
expectedWeiConstElemType = ElementType::f32;
auto matMul0 = builder::makeMatMul(params[0], inputWeights, transpA, transpB);
auto matMul1 = builder::makeMatMul(params[1], inputWeights, transpA, transpB);
auto matMul0 = std::make_shared<ov::op::v0::MatMul>(params[0], inputWeights, transpA, transpB);
auto matMul1 = std::make_shared<ov::op::v0::MatMul>(params[1], inputWeights, transpA, transpB);
auto concat = builder::makeConcat({matMul0, matMul1}, 0);

View File

@ -85,7 +85,7 @@ protected:
matMul = std::make_shared<ngraph::opset1::Add>(fc, biasWeightsNode);
} else {
auto fq2 = ngraph::builder::makeFakeQuantize(inputParams[0], ngPrec, 256, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f});
matMul = builder::makeMatMul(fq1, fq2, false, true);
matMul = std::make_shared<ov::op::v0::MatMul>(fq1, fq2, false, true);
matMul->get_rt_info() = getCPUInfo();
matMul->set_friendly_name(nameMatmul);
}
@ -101,7 +101,7 @@ protected:
auto filterWeightsNode = ngraph::builder::makeConstant(element::f32, filterWeightsShape, std::vector<float>{}, true);
auto fq3 = ngraph::builder::makeFakeQuantize(filterWeightsNode, ngPrec, 256, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f});
// only matmul avx2 support s8*s8 input
auto matMul2 = builder::makeMatMul(nodeBeforeConv, fq3, false, false);
auto matMul2 = std::make_shared<ov::op::v0::MatMul>(nodeBeforeConv, fq3, false, false);
function = makeNgraphFunction(ngPrec, inputParams, matMul2, "MatmulBrgemmInt8");
}

View File

@ -44,12 +44,12 @@ protected:
const auto concatOutputNodes = helpers::convert2OutputVector(helpers::castOps2Nodes<op::Parameter>(concatInputParams));
const auto concat = builder::makeConcat(concatOutputNodes, 2);
const auto matMul1 = builder::makeMatMul(split->output(0), concat, false, false);
const auto matMul1 = std::make_shared<ov::op::v0::MatMul>(split->output(0), concat, false, false);
SizeVector matmulShape{1, 1, 16, 8};
ov::ParameterVector matmulInputParams {std::make_shared<ov::op::v0::Parameter>(ngPrec, ov::Shape(matmulShape))};
const auto matMul2 = builder::makeMatMul(split->output(1), matmulInputParams[0], false, false);
const auto matMul2 = std::make_shared<ov::op::v0::MatMul>(split->output(1), matmulInputParams[0], false, false);
const auto concatMatMuls = builder::makeConcat({matMul1, matMul2}, 2 /* 3rd axis */);

View File

@ -221,7 +221,7 @@ protected:
transpose_weights,
add_subtract,
reshape_on_decompression);
auto matMul = builder::makeMatMul(params[0], weights_subgraph);
auto matMul = std::make_shared<ov::op::v0::MatMul>(params[0], weights_subgraph);
return makeNgraphFunction(data_precision, params, matMul, "MatmulWeightsDecompression");
}

View File

@ -86,7 +86,7 @@ protected:
auto reshape = std::make_shared<ngraph::opset1::Reshape>(params[0], reshapeData, true);
auto weight = ngraph::builder::makeDynamicInputLayer(prc, ngraph::helpers::InputLayerType::CONSTANT, inputDynamicShapes.back());
auto matMul = ngraph::builder::makeMatMul(reshape, weight, false, false);
auto matMul = std::make_shared<ov::op::v0::MatMul>(reshape, weight, false, false);
function = makeNgraphFunction(prc, params, matMul, "ReshapeFcModel");
}

View File

@ -111,7 +111,7 @@ protected:
auto split = builder::makeVariadicSplit(params[0], {1, 1}, 0);
auto matMul = builder::makeMatMul(split->output(0), inputB, transpA, transpB);
auto matMul = std::make_shared<ov::op::v0::MatMul>(split->output(0), inputB, transpA, transpB);
auto concat = builder::makeConcat({matMul, split->output(1)}, 0);

View File

@ -80,7 +80,7 @@ protected:
size_t elemNum = inputShape[inputShape.size() - 1];
std::vector<float> weights = ov::test::utils::generate_float_numbers(elemNum * elemNum, -0.1f, 0.1f);
auto weightsNode = std::make_shared<ngraph::opset7::Constant>(ngPrc, ngraph::Shape{elemNum, elemNum}, weights);
auto matmul = ngraph::builder::makeMatMul(params[0], weightsNode, false, true);
auto matmul = std::make_shared<ov::op::v0::MatMul>(params[0], weightsNode, false, true);
auto bias = ngraph::builder::makeConstant(ngPrc, std::vector<size_t>{1, batch, 1}, std::vector<float>{1.0f});
auto add = ngraph::builder::makeEltwise(matmul, bias, ngraph::helpers::EltwiseTypes::ADD);
@ -168,7 +168,7 @@ protected:
weightsLowNode,
weightsHighNode,
UINT16_MAX);
auto matmul = ngraph::builder::makeMatMul(inputFQ, weightsFQNode, false, true);
auto matmul = std::make_shared<ov::op::v0::MatMul>(inputFQ, weightsFQNode, false, true);
auto bias = ngraph::builder::makeConstant(ngPrc, std::vector<size_t>{1, 1, 1}, std::vector<float>{1.0f});
auto add = ngraph::builder::makeEltwise(matmul, bias, ngraph::helpers::EltwiseTypes::ADD);

View File

@ -136,7 +136,7 @@ protected:
auto mm_const = makeConstant<float>(precision, {height, width}, {}, true);
auto mm_const_fq = CreateFQNode(precision, mm_const, fq_min_max[1][0], fq_min_max[1][1], fq_levels);
auto matmul = makeMatMul(mm_const_fq, reshape);
auto matmul = std::make_shared<ov::op::v0::MatMul>(mm_const_fq, reshape);
auto matmul_fq = CreateFQNode(precision, matmul, fq_min_max[2][0], fq_min_max[2][1], fq_levels);
auto add_mm_reshape = CreateReshapeNode(ngraph::element::Type_t::i32, matmul, {height});

View File

@ -86,8 +86,8 @@ protected:
std::make_shared<ngraph::opset1::Constant>(ngPrc, ngraph::Shape{matmul_in_shape[1], 1}, weights);
}
auto matmul = firstInConst ? ngraph::builder::makeMatMul(weights_node, reshape, false, false)
: ngraph::builder::makeMatMul(reshape, weights_node, false, false);
auto matmul = firstInConst ? std::make_shared<ov::op::v0::MatMul>(weights_node, reshape, false, false)
: std::make_shared<ov::op::v0::MatMul>(reshape, weights_node, false, false);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(matmul)};
function = std::make_shared<ngraph::Function>(results, params, "InsertTransposeBeforeMatmul");
@ -178,8 +178,8 @@ protected:
weights_node =
std::make_shared<ngraph::opset1::Constant>(ngPrc, ngraph::Shape{1, matmul_in_shape[0] * 2}, weights);
auto matmul = firstInConst ? ngraph::builder::makeMatMul(weights_node, concat, false, false)
: ngraph::builder::makeMatMul(concat, weights_node, false, false);
auto matmul = firstInConst ? std::make_shared<ov::op::v0::MatMul>(weights_node, concat, false, false)
: std::make_shared<ov::op::v0::MatMul>(concat, weights_node, false, false);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(matmul)};
function = std::make_shared<ngraph::Function>(results, params, "InsertTransposeBeforeConcatConcat");

View File

@ -106,10 +106,8 @@ protected:
matmul_input2 = std::make_shared<ngraph::opset8::Reshape>(fqIn2, pattern, false);
}
auto matmul = swapInputs ? std::dynamic_pointer_cast<ngraph::opset8::MatMul>(
ngraph::builder::makeMatMul(matmul_input2, fqIn1, false, true))
: std::dynamic_pointer_cast<ngraph::opset8::MatMul>(
ngraph::builder::makeMatMul(fqIn1, matmul_input2, false, true));
auto matmul = swapInputs ? std::make_shared<ov::op::v0::MatMul>(matmul_input2, fqIn1, false, true)
: std::make_shared<ov::op::v0::MatMul>(fqIn1, matmul_input2, false, true);
auto lowNodeOut =
ngraph::builder::makeConstant<float>(ngPrc, {1}, {-maxInputValue * maxInputValue * inputShape[1] / 10});

View File

@ -122,7 +122,7 @@ protected:
if (secondaryInputType == helpers::InputLayerType::PARAMETER) {
params.push_back(std::dynamic_pointer_cast<opset1::Parameter>(matrixB));
}
auto matMul = builder::makeMatMul(params[0], matrixB, transpA, transpB);
auto matMul = std::make_shared<ov::op::v0::MatMul>(params[0], matrixB, transpA, transpB);
auto makeFunction = [](const ngraph::element::Type &ngPrc, ngraph::ParameterVector &params, const std::shared_ptr<ngraph::Node> &lastNode) {
ngraph::ResultVector results;

View File

@ -106,7 +106,7 @@ void SetBlobTest::SetUp() {
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(precNg);
ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(IS))};
auto axisNode = std::make_shared<ngraph::op::Constant>(ngraph::element::Type_t::i64, ngraph::Shape{}, std::vector<int64_t>{-1})->output(0);
auto cumSum = std::dynamic_pointer_cast<ngraph::opset4::CumSum>(ngraph::builder::makeCumSum(params[0], axisNode, false, false));
auto cumSum = std::make_shared<ov::op::v0::CumSum>(params[0], axisNode, false, false);
ngraph::ResultVector results{std::make_shared<ngraph::opset4::Result>(cumSum)};
function = std::make_shared<ngraph::Function>(results, params, "InferSetBlob");
}

View File

@ -74,22 +74,26 @@ void ProposalBehTest::SetUp() {
params[0]->set_friendly_name("scores");
params[1]->set_friendly_name("boxes");
auto proposal = std::dynamic_pointer_cast<ngraph::opset1::Proposal>(
ngraph::builder::makeProposal(params[0], params[1], img_info, ngPrc,
base_size,
pre_nms_topn,
post_nms_topn,
nms_thresh,
feat_stride,
min_size,
ratio,
scale,
clip_before_nms,
clip_after_nms,
normalize,
box_size_scale,
box_coordinate_scale,
framework));
ov::op::v0::Proposal::Attributes attrs;
attrs.base_size = base_size;
attrs.pre_nms_topn = pre_nms_topn;
attrs.post_nms_topn = post_nms_topn;
attrs.nms_thresh = nms_thresh;
attrs.feat_stride = feat_stride;
attrs.min_size = min_size;
attrs.ratio = ratio;
attrs.scale = scale;
attrs.clip_before_nms = clip_before_nms;
attrs.clip_after_nms = clip_after_nms;
attrs.normalize = normalize;
attrs.box_size_scale = box_size_scale;
attrs.box_coordinate_scale = box_coordinate_scale;
attrs.framework = framework;
attrs.infer_probs = true;
auto image_shape = std::make_shared<ov::op::v0::Constant>(ov::element::f32, ov::Shape{3}, img_info);
auto proposal = std::make_shared<ov::op::v4::Proposal>(params[0], params[1], image_shape, attrs);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(proposal)};
function = std::make_shared<ngraph::Function>(results, params, "proposal");

View File

@ -67,8 +67,7 @@ void MatMulTest::SetUp() {
if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) {
params.push_back(std::dynamic_pointer_cast<ngraph::opset3::Parameter>(secondaryInput));
}
auto MatMul = std::dynamic_pointer_cast<ngraph::opset3::MatMul>(
ngraph::builder::makeMatMul(params[0], secondaryInput, shapeRelatedParams.input1.second, shapeRelatedParams.input2.second));
auto MatMul = std::make_shared<ov::op::v0::MatMul>(params[0], secondaryInput, shapeRelatedParams.input1.second, shapeRelatedParams.input2.second);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(MatMul)};
function = std::make_shared<ngraph::Function>(results, params, "MatMul");
}

View File

@ -44,7 +44,9 @@ namespace LayerTestsDefinitions {
input.push_back(std::dynamic_pointer_cast<ngraph::opset3::Parameter>(secondaryInput));
}
OPENVINO_SUPPRESS_DEPRECATED_START
auto op = ngraph::builder::makeMinMax(input[0], secondaryInput, opType);
OPENVINO_SUPPRESS_DEPRECATED_END
function = std::make_shared<ngraph::Function>(op, input, "MinMax");
}
} // namespace LayerTestsDefinitions

View File

@ -152,6 +152,7 @@ void ProposalLayerTest::SetUp() {
params[0]->set_friendly_name("a_scores");
params[1]->set_friendly_name("b_boxes");
OPENVINO_SUPPRESS_DEPRECATED_START
auto proposal = std::dynamic_pointer_cast<ngraph::opset4::Proposal>(
ngraph::builder::makeProposal(params[0], params[1], img_info, ngPrc,
base_size,
@ -168,6 +169,7 @@ void ProposalLayerTest::SetUp() {
box_size_scale,
box_coordinate_scale,
framework));
OPENVINO_SUPPRESS_DEPRECATED_END
ngraph::ResultVector results{
std::make_shared<ngraph::opset1::Result>(proposal->output(0)),

View File

@ -40,8 +40,7 @@ void ShuffleChannelsLayerTest::SetUp() {
std::tie(axis, group) = shuffleChannelsParams;
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(inputShape))};
auto shuffleChannels = std::dynamic_pointer_cast<ngraph::opset3::ShuffleChannels>(
ngraph::builder::makeShuffleChannels(params[0], axis, group));
auto shuffleChannels = std::make_shared<ov::op::v0::ShuffleChannels>(params[0], axis, group);
ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(shuffleChannels)};
function = std::make_shared<ngraph::Function>(results, params, "shuffleChannels");
}

View File

@ -46,7 +46,9 @@ void SpaceToDepthLayerTest::SetUp() {
std::tie(inShape, inputPrecision, mode, blockSize, targetDevice) = this->GetParam();
auto inPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inputPrecision);
ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(inPrc, ov::Shape(inShape))};
auto s2d = ngraph::builder::makeSpaceToDepth(params[0], mode, blockSize);
OPENVINO_SUPPRESS_DEPRECATED_START
auto s2d = std::make_shared<ov::op::v0::SpaceToDepth>(params[0], mode, blockSize);
OPENVINO_SUPPRESS_DEPRECATED_END
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(s2d)};
function = std::make_shared<ngraph::Function>(results, params, "SpaceToDepth");
}

View File

@ -44,7 +44,9 @@ void SqueezeUnsqueezeLayerTest::SetUp() {
if (axesVector.empty() && opType == ngraph::helpers::SqueezeOpType::SQUEEZE) {
op = std::make_shared<ngraph::opset1::Squeeze>(params.front());
} else {
OPENVINO_SUPPRESS_DEPRECATED_START
op = ngraph::builder::makeSqueezeUnsqueeze(params.front(), ngraph::element::i64, axesVector, opType);
OPENVINO_SUPPRESS_DEPRECATED_END
}
const ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(op)};

View File

@ -42,8 +42,12 @@ void CascadeConcat::SetUp() {
auto concat = std::make_shared<ngraph::opset1::Concat>(ngraph::OutputVector{relu1->output(0),
relu2->output(0)},
1);
auto reshape = ngraph::builder::makeSqueezeUnsqueeze(concat, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::UNSQUEEZE);
auto reshape2 = ngraph::builder::makeSqueezeUnsqueeze(reshape, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::SQUEEZE);
auto reshape_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto reshape = std::make_shared<ov::op::v0::Squeeze>(concat, reshape_constant);
auto reshape2_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto reshape2 = std::make_shared<ov::op::v0::Unsqueeze>(reshape, reshape2_constant);
auto concat2 = std::make_shared<ngraph::opset1::Concat>(ngraph::OutputVector{reshape2->output(0),
relu3->output(0)},
1);
@ -108,10 +112,13 @@ void CascadeConcatWithMultiConnReshape::SetUp() {
auto const1 = ngraph::builder::makeConstant(ngPrc, inputShapeSqueezed, std::vector<float>{}, true);
auto concat1 = ngraph::builder::makeConcat({relu, const1}, inputShapeSqueezed.size() - 1);
auto squeeze = ngraph::builder::makeSqueezeUnsqueeze(concat1, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::SQUEEZE);
auto squeeze_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto squeeze = std::make_shared<ov::op::v0::Squeeze>(concat1, squeeze_constant);
auto relu1 = std::make_shared<ngraph::opset8::Relu>(squeeze);
auto unsqueeze1 = ngraph::builder::makeSqueezeUnsqueeze(relu1, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::UNSQUEEZE);
auto unsqueeze1_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto unsqueeze1 = std::make_shared<ov::op::v0::Unsqueeze>(relu1, unsqueeze1_constant);
auto const2 = ngraph::builder::makeConstant(ngPrc, inputShape, std::vector<float>{}, true);
auto concat2 = ngraph::builder::makeConcat({squeeze, const2}, 1);
@ -119,7 +126,10 @@ void CascadeConcatWithMultiConnReshape::SetUp() {
concat2->set_friendly_name("XConcat");
auto relu2 = std::make_shared<ngraph::opset8::Relu>(concat2);
auto unsqueeze2 = ngraph::builder::makeSqueezeUnsqueeze(relu2, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::UNSQUEEZE);
auto unsqueeze2_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto unsqueeze2 = std::make_shared<ov::op::v0::Unsqueeze>(relu2, unsqueeze2_constant);
ngraph::ResultVector results = {std::make_shared<ngraph::opset1::Result>(unsqueeze1),
std::make_shared<ngraph::opset1::Result>(unsqueeze2)};

View File

@ -40,7 +40,7 @@ void FqWithMixedLevelsTest::SetUp() {
std::vector<float> weights = ov::test::utils::generate_float_numbers(shapes[1][0] * shapes[1][1], weights_min, weights_max);
auto constant = std::make_shared<ngraph::opset7::Constant>(ngPrc, ngraph::Shape{shapes[1][0], shapes[1][1]}, weights);
auto fake2 = ngraph::builder::makeFakeQuantize(constant, ngPrc, level2, { 1 }, data2[0], data2[1], data2[2], data2[3]);
auto matmul = ngraph::builder::makeMatMul(fake1, fake2, false, true);
auto matmul = std::make_shared<ov::op::v0::MatMul>(fake1, fake2, false, true);
auto bias = ngraph::builder::makeConstant(ngPrc, std::vector<size_t>{shapes[0][0], shapes[1][0]}, std::vector<float>{ 1.0 });
auto add = ngraph::builder::makeEltwise(matmul, bias, ngraph::helpers::EltwiseTypes::ADD);
return ngraph::builder::makeFakeQuantize(add, ngPrc, level3, { 1 }, data3[0], data3[1], data3[2], data3[3]);

View File

@ -37,8 +37,12 @@ namespace SubgraphTestsDefinitions {
ngraph::Shape{input[0]->get_shape()},
std::vector<float>{-1.0f});
auto eltwise = std::make_shared<ngraph::opset1::Multiply>(input[0], eltwise_const);
auto squeeze = ngraph::builder::makeSqueezeUnsqueeze(eltwise, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::UNSQUEEZE);
auto unsqueeze = ngraph::builder::makeSqueezeUnsqueeze(squeeze, ngraph::element::i64, {0}, ngraph::helpers::SqueezeOpType::SQUEEZE);
auto squeeze_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto squeeze = std::make_shared<ov::op::v0::Unsqueeze>(eltwise, squeeze_constant);
auto unsqueeze_constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int64_t>{0});
auto unsqueeze = std::make_shared<ov::op::v0::Squeeze>(squeeze, unsqueeze_constant);
auto eltwise_const2 = ngraph::builder::makeConstant(ngPrc, ngraph::Shape{1}, std::vector<float>{1.01f});
auto eltwise_const3 = ngraph::builder::makeConstant(ngPrc, ngraph::Shape{1}, std::vector<float>{1.01f});
auto eltwise2 = std::make_shared<ngraph::opset1::Multiply>(eltwise, eltwise_const2);

View File

@ -92,8 +92,7 @@ void QuantMatMulTest::SetUp() {
auto dataFq0 = makeFakeQuantizeNode(quantLevels0, inputRange0, outputRange0, quantGranularity0, params[0], inputShape0, fqPrec0);
auto dataFq1 = makeFakeQuantizeNode(quantLevels1, inputRange1, outputRange1, quantGranularity1, params[1], inputShape1, fqPrec1);
auto MatMul = std::dynamic_pointer_cast<ngraph::opset3::MatMul>(
ngraph::builder::makeMatMul(dataFq0, dataFq1));
auto MatMul = std::make_shared<ov::op::v0::MatMul>(dataFq0, dataFq1);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(MatMul)};
function = std::make_shared<ngraph::Function>(results, params, "QuantMatMul");
}

View File

@ -37,7 +37,20 @@ void ReshapeSqueezeReshapeRelu::SetUp() {
ov::Shape{squeezeShape.first.size()},
squeezeShape.first);
auto reshape1 = std::make_shared<ov::op::v1::Reshape>(input[0], reshape1_pattern, false);
auto squeeze = ngraph::builder::makeSqueezeUnsqueeze(reshape1, ov::element::i64, squeezeShape.second, opType);
auto constant = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{squeezeShape.second.size()}, squeezeShape.second);
std::shared_ptr<ov::Node> squeeze;
switch (opType) {
case ov::test::utils::SqueezeOpType::SQUEEZE:
squeeze = std::make_shared<ov::op::v0::Squeeze>(reshape1, constant);
break;
case ov::test::utils::SqueezeOpType::UNSQUEEZE:
squeeze = std::make_shared<ov::op::v0::Unsqueeze>(reshape1, constant);
break;
default:
throw std::logic_error("Unsupported operation type");
}
auto reshape2_pattern =
std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{2}, std::vector<size_t>{1, input_dim});
auto reshape2 = std::make_shared<ov::op::v1::Reshape>(squeeze, reshape2_pattern, false);

View File

@ -345,21 +345,25 @@ std::shared_ptr<ov::Node> makeMVN(const ov::Output<Node>& in,
bool normalizeVariance,
double eps);
OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.")
std::shared_ptr<ov::Node> makeMVN6(const Output<Node>& in,
const Output<Node>& axesNode,
bool normalizeVariance,
float eps,
std::string& epsMode);
OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.")
std::shared_ptr<ov::Node> makeSqueezeUnsqueeze(const ov::Output<Node>& in,
const element::Type& type,
const std::vector<int>& squeeze_indices,
ov::test::utils::SqueezeOpType opType);
OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.")
std::shared_ptr<ov::Node> makeMinMax(const ov::Output<Node>& in1,
const ov::Output<Node>& in2,
ov::test::utils::MinMaxOpType opType);
OPENVINO_DEPRECATED("This function is deprecated and will be removed soon.")
std::shared_ptr<ov::Node> makeProposal(const ov::Output<Node>& class_probs,
const ov::Output<Node>& class_logits,
const std::vector<float>& image_info,
@ -379,9 +383,6 @@ std::shared_ptr<ov::Node> makeProposal(const ov::Output<Node>& class_probs,
float box_coordinate_scale,
std::string framework);
std::shared_ptr<ov::Node> makeSelect(std::vector<ov::Output<Node>>& in,
const ov::op::AutoBroadcastSpec& auto_broadcast);
std::shared_ptr<Node> makeFakeQuantize(const ov::Output<Node>& in,
const element::Type& type,
std::size_t levels,
@ -397,11 +398,6 @@ std::shared_ptr<Node> makeFakeQuantize(const ov::Output<Node>& in,
std::vector<size_t> constShapes,
const int32_t seed = 1);
std::shared_ptr<ov::Node> makeCumSum(const ov::Output<Node>& in,
const ov::Output<Node>& axis,
bool exclusive,
bool reverse);
std::shared_ptr<ov::Node> makeEmbeddingBagOffsetsSum(const element::Type& dataType,
const element::Type& indicesType,
const ov::Output<Node>& emb_table_node,
@ -427,17 +423,6 @@ std::shared_ptr<ov::Node> makeEmbeddingSegmentsSum(const element::Type& dataType
bool with_weights,
bool with_default_index);
std::shared_ptr<ov::Node> makeSpaceToDepth(const ov::Output<Node>& in,
ov::op::v0::SpaceToDepth::SpaceToDepthMode mode,
size_t blockSize);
std::shared_ptr<Node> makeShuffleChannels(const ov::Output<Node>& in, int axis, int group);
std::shared_ptr<Node> makeMatMul(const Output<Node>& A,
const Output<Node>& B,
bool transpose_a = false,
bool transpose_b = false);
std::shared_ptr<ov::Node> makeReduce(const ov::Output<Node>& data,
const ov::Output<Node>& axes,
bool keepDims,

View File

@ -1,20 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "openvino/op/cum_sum.hpp"
#include "ov_models/builders.hpp"
namespace ngraph {
namespace builder {
std::shared_ptr<ov::Node> makeCumSum(const ov::Output<Node>& in,
const ov::Output<Node>& axis,
bool exclusive,
bool reverse) {
return std::make_shared<ov::op::v0::CumSum>(in, axis, exclusive, reverse);
}
} // namespace builder
} // namespace ngraph

View File

@ -1,16 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "openvino/op/matmul.hpp"
#include "ov_models/builders.hpp"
namespace ngraph {
namespace builder {
std::shared_ptr<Node> makeMatMul(const Output<Node>& A, const Output<Node>& B, bool transpose_a, bool transpose_b) {
return std::make_shared<ov::op::v0::MatMul>(A, B, transpose_a, transpose_b);
}
} // namespace builder
} // namespace ngraph

View File

@ -1,19 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "openvino/op/select.hpp"
#include "ov_models/builders.hpp"
namespace ngraph {
namespace builder {
std::shared_ptr<ov::Node> makeSelect(std::vector<ov::Output<Node>>& in,
const ov::op::AutoBroadcastSpec& auto_broadcast) {
auto selectNode = std::make_shared<ov::op::v1::Select>(in[0], in[1], in[2], auto_broadcast);
return selectNode;
}
} // namespace builder
} // namespace ngraph

View File

@ -1,20 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "openvino/op/shuffle_channels.hpp"
#include <memory>
#include <vector>
#include "ov_models/builders.hpp"
namespace ngraph {
namespace builder {
std::shared_ptr<Node> makeShuffleChannels(const ov::Output<Node>& in, int axis, int group) {
return std::make_shared<ov::op::v0::ShuffleChannels>(in, axis, group);
}
} // namespace builder
} // namespace ngraph

View File

@ -1,18 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "ov_models/builders.hpp"
namespace ngraph {
namespace builder {
std::shared_ptr<ov::Node> makeSpaceToDepth(const ov::Output<Node>& in,
ov::op::v0::SpaceToDepth::SpaceToDepthMode mode,
size_t blockSize) {
auto dtsNode = std::make_shared<ov::op::v0::SpaceToDepth>(in, mode, blockSize);
return dtsNode;
}
} // namespace builder
} // namespace ngraph