Skip to content

Commit

Permalink
Get rid of legacy builders
Browse files Browse the repository at this point in the history
  • Loading branch information
olpipi committed Jan 3, 2024
1 parent e430095 commit 028fc82
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <cuda_test_constants.hpp>
#include <vector>

#include "common_test_utils/subgraph_builders/split_conv_concat.hpp"

using namespace ov::test::behavior;

namespace {
Expand All @@ -18,7 +20,7 @@ const std::vector<ov::AnyMap> HeteroConfigs = {{ov::device::priorities(ov::test:
INSTANTIATE_TEST_SUITE_P(
smoke_BehaviorTests,
OVInferRequestDynamicTests,
::testing::Combine(::testing::Values(ngraph::builder::subgraph::makeSplitConvConcat()),
::testing::Combine(::testing::Values(ov::test::utils::make_split_conv_concat()),
::testing::Values(std::vector<std::pair<std::vector<size_t>, std::vector<size_t>>>{
{{1, 4, 20, 20}, {1, 10, 18, 18}}, {{2, 4, 20, 20}, {2, 10, 18, 18}}}),
::testing::Values(ov::test::utils::DEVICE_NVIDIA),
Expand All @@ -28,7 +30,7 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
smoke_Hetero_BehaviorTests,
OVInferRequestDynamicTests,
::testing::Combine(::testing::Values(ngraph::builder::subgraph::makeSplitConvConcat()),
::testing::Combine(::testing::Values(ov::test::utils::make_split_conv_concat()),
::testing::Values(std::vector<std::pair<std::vector<size_t>, std::vector<size_t>>>{
{{1, 4, 20, 20}, {1, 10, 18, 18}}, {{2, 4, 20, 20}, {2, 10, 18, 18}}}),
::testing::Values(ov::test::utils::DEVICE_HETERO),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <vector>

#include "behavior/plugin/hetero_synthetic.hpp"
#include "ov_models/builders.hpp"
#include "ov_models/subgraph_builders.hpp"
#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp"
#include "common_test_utils/subgraph_builders/conv_pool_relu_non_zero.hpp"

namespace {
using namespace HeteroTests;
Expand All @@ -21,7 +21,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Combine(::testing::Values(std::vector<PluginParameter>{{"NVIDIA", "openvino_nvidia_gpu_plugin"},
{"NVIDIA", "openvino_nvidia_gpu_plugin"}}),
::testing::ValuesIn(HeteroTests::HeteroSyntheticTest::withMajorNodesFunctions(
[] { return ngraph::builder::subgraph::makeConvPool2Relu2(); }, {"Conv_1"}, true))),
[] { return ov::test::utils::make_conv_pool2_relu2(); }, {"Conv_1"}, true))),
HeteroSyntheticTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
Expand All @@ -41,7 +41,7 @@ INSTANTIATE_TEST_SUITE_P(
HeteroSyntheticTest::getTestCaseName);

static std::vector<std::function<std::shared_ptr<ngraph::Function>()>> dynamicBuilders = {
[] { return ngraph::builder::subgraph::makeConvPoolReluNonZero(); },
[] { return ov::test::utils::make_conv_pool_relu_non_zero(); },
};

INSTANTIATE_TEST_SUITE_P(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include "cuda_test_constants.hpp"
#include "finite_comparer.hpp"
#include "ov_models/builders.hpp"

using namespace LayerTestsDefinitions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "cuda_test_constants.hpp"
#include "finite_comparer.hpp"
#include "ov_models/builders.hpp"
#include "shared_test_classes/single_layer/convolution_backprop_data.hpp"

using namespace LayerTestsDefinitions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <ngraph/node.hpp>
#include <ngraph/shape.hpp>
#include <ngraph/type/element_type.hpp>
#include <ov_models/builders.hpp>
#include <ov_models/utils/ov_helpers.hpp>
#include "openvino/opsets/opset1.hpp"
#include <openvino/op/util/attr_types.hpp>
Expand All @@ -29,6 +28,9 @@
#include <tuple>
#include <type_traits>
#include <vector>
#include "common_test_utils/node_builders/activation.hpp"
#include "common_test_utils/node_builders/convolution.hpp"
#include "common_test_utils/node_builders/group_convolution.hpp"

namespace LayerTestsDefinitions {
using ov::test::utils::ActivationTypes;
Expand Down Expand Up @@ -135,7 +137,7 @@ class BasicConvolutionBiasAddActivationLayerTest
lastNode = biasAddLayer;
}
if (activation != ActivationTypes::None) {
lastNode = ngraph::builder::makeActivation(lastNode, ngNetPrc, activation);
lastNode = ov::test::utils::make_activation(lastNode, ngNetPrc, activation);
}

ov::ResultVector results{std::make_shared<ov::opset1::Result>(lastNode)};
Expand Down Expand Up @@ -169,30 +171,30 @@ class BasicConvolutionBiasAddActivationLayerTest

std::shared_ptr<ov::Node> convNode = nullptr;
if constexpr (!isGroup) {
convNode = ngraph::builder::makeConvolution(params[0],
ngPrc,
kernel,
stride,
padBegin,
padEnd,
dilation,
padType,
convOutChannels,
false,
filter_weights);
convNode = ov::test::utils::make_convolution(params[0],
ngPrc,
kernel,
stride,
padBegin,
padEnd,
dilation,
padType,
convOutChannels,
false,
filter_weights);
} else {
convNode = ngraph::builder::makeGroupConvolution(params[0],
ngPrc,
kernel,
stride,
padBegin,
padEnd,
dilation,
padType,
convOutChannels,
numGroups,
false,
filter_weights);
convNode = ov::test::utils::make_group_convolution(params[0],
ngPrc,
kernel,
stride,
padBegin,
padEnd,
dilation,
padType,
convOutChannels,
numGroups,
false,
filter_weights);
}
return std::make_tuple(ngPrc, params, std::dynamic_pointer_cast<typename Traits::ConvNode>(convNode));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include <ngraph/op/parameter.hpp>
#include <ngraph/type/bfloat16.hpp>
#include <ngraph/type/float16.hpp>
#include <ov_models/builders.hpp>
#include <ov_models/utils/ov_helpers.hpp>
#include <sstream>
#include <vector>
#include "common_test_utils/node_builders/eltwise.hpp"

namespace LayerTestsDefinitions {

Expand Down Expand Up @@ -272,7 +272,7 @@ void CudaEltwiseLayerTest::SetUp() {
const bool is_python_divide = mode == OperationMode::PYTHON_DIVIDE;
auto eltwise = eltwiseType == EltwiseTypes::DIVIDE
? std::make_shared<ngraph::op::v1::Divide>(parameters[0], secondaryInput, is_python_divide)
: ngraph::builder::makeEltwise(parameters[0], secondaryInput, eltwiseType);
: ov::test::utils::make_eltwise(parameters[0], secondaryInput, eltwiseType);
function = std::make_shared<ngraph::Function>(eltwise, parameters, "Eltwise");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include "cuda_test_constants.hpp"
#include "finite_comparer.hpp"
#include "ov_models/builders.hpp"

using namespace LayerTestsDefinitions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <vector>

#include "unsymmetrical_comparer.hpp"
#include "common_test_utils/node_builders/gru_cell.hpp"

using ov::test::utils::InputLayerType;
using ov::test::utils::SequenceTestsMode;
Expand Down Expand Up @@ -107,17 +108,17 @@ class LPCNetCUDNNGRUSequenceTest : public UnsymmetricalComparer<GRUSequenceTest>
ASSERT_EQ(InputLayerType::CONSTANT, WRBType);
std::vector<ov::Shape> WRB = {inputShapes[3], inputShapes[4], inputShapes[5], inputShapes[2]};
auto gru_sequence =
ngraph::builder::makeGRU(ov::OutputVector{params[0], params[1]},
WRB,
hidden_size,
activations,
{},
{},
clip,
linear_before_reset,
true,
direction,
mode);
ov::test::utils::make_gru(ov::OutputVector{params[0], params[1]},
WRB,
hidden_size,
activations,
{},
{},
clip,
linear_before_reset,
true,
direction,
mode);
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(gru_sequence->output(0)),
std::make_shared<ov::op::v0::Result>(gru_sequence->output(1))};
function = std::make_shared<ngraph::Function>(results, params, "gru_sequence");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "cuda_operation_registry.hpp"
#include "cuda_thread_context.hpp"
#include "unsymmetrical_comparer.hpp"
#include "common_test_utils/node_builders/constant.hpp"

namespace LayerTestsDefinitions {
using ov::test::utils::InputLayerType;
Expand Down Expand Up @@ -180,11 +181,11 @@ class CUDALSTMSequenceOptimizedTest : public testing::WithParamInterface<LSTMSeq
seq_lengths_node->set_friendly_name("seq_lengths");
params.push_back(param);
} else if (m_mode == SequenceTestsMode::PURE_SEQ_RAND_SEQ_LEN_CONST) {
seq_lengths_node = ngraph::builder::makeConstant<int64_t>(
seq_lengths_node = ov::test::utils::make_constant<int64_t>(
ov::element::i64, input_shapes[3], {}, true, static_cast<int64_t>(seq_lengths), 0.f);
} else {
std::vector<int64_t> lengths(input_shapes[3][0], seq_lengths);
seq_lengths_node = ngraph::builder::makeConstant(ov::element::i64, input_shapes[3], lengths, false);
seq_lengths_node = ov::test::utils::make_constant(ov::element::i64, input_shapes[3], lengths, false);
}
std::shared_ptr<ov::Node> W, R, B;
if (WRBType == InputLayerType::PARAMETER) {
Expand All @@ -198,9 +199,9 @@ class CUDALSTMSequenceOptimizedTest : public testing::WithParamInterface<LSTMSeq
params.push_back(R_param);
params.push_back(B_param);
} else {
W = ngraph::builder::makeConstant(ngPrc, W_shape, {}, true, up_to, start_from, counter++);
R = ngraph::builder::makeConstant(ngPrc, R_shape, {}, true, up_to, start_from, counter++);
B = ngraph::builder::makeConstant(ngPrc, B_shape, {}, true, up_to, start_from, counter++);
W = ov::test::utils::make_constant(ngPrc, W_shape, {}, true, up_to, start_from, counter++);
R = ov::test::utils::make_constant(ngPrc, R_shape, {}, true, up_to, start_from, counter++);
B = ov::test::utils::make_constant(ngPrc, B_shape, {}, true, up_to, start_from, counter++);
}

auto lstm_sequence = std::make_shared<ov::op::v5::LSTMSequence>(x_node,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <ops/parameter.hpp>

#include "kernels/details/cuda_type_traits.hpp"
#include "ov_models/builders.hpp"

namespace {

Expand Down
12 changes: 6 additions & 6 deletions modules/nvidia_plugin/tests/unit/cuda_multi_graph_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

#include "cuda_graph_topology_runner.hpp"
#include "cuda_simple_execution_delegator.hpp"
#include "ov_models/builders.hpp"
#include "ov_models/utils/data_utils.hpp"
#include "ops/parameter.hpp"
#include "ops/result.hpp"
#include "common_test_utils/node_builders/eltwise.hpp"

using namespace ov::nvidia_gpu;
using namespace testing;
Expand Down Expand Up @@ -64,10 +64,10 @@ class AddMul {
for (std::size_t i = 0; i < INPUTS_COUNT; ++i) {
params.emplace_back(std::make_shared<ov::op::v0::Parameter>(prc, shape));
}
const auto add0 = ngraph::builder::makeEltwise(params[0], params[1], EltwiseTypes::ADD);
const auto add1 = ngraph::builder::makeEltwise(params[2], params[3], EltwiseTypes::ADD);
const auto add0 = ov::test::utils::make_eltwise(params[0], params[1], EltwiseTypes::ADD);
const auto add1 = ov::test::utils::make_eltwise(params[2], params[3], EltwiseTypes::ADD);

const auto mul = ngraph::builder::makeEltwise(add0, add1, EltwiseTypes::MULTIPLY);
const auto mul = ov::test::utils::make_eltwise(add0, add1, EltwiseTypes::MULTIPLY);
const auto result = std::make_shared<ov::op::v0::Result>(mul);
return std::make_shared<ov::Model>(result, params, "AddMul");
}
Expand Down Expand Up @@ -109,8 +109,8 @@ class AddConcat {
for (std::size_t i = 0; i < INPUTS_COUNT; ++i) {
params.emplace_back(std::make_shared<ov::op::v0::Parameter>(prc, shape));
}
const auto add0 = ngraph::builder::makeEltwise(params[0], params[1], EltwiseTypes::ADD);
const auto add1 = ngraph::builder::makeEltwise(params[2], params[3], EltwiseTypes::ADD);
const auto add0 = ov::test::utils::make_eltwise(params[0], params[1], EltwiseTypes::ADD);
const auto add1 = ov::test::utils::make_eltwise(params[2], params[3], EltwiseTypes::ADD);

constexpr int64_t axis = CONCAT_AXIS;
const auto concat =
Expand Down

0 comments on commit 028fc82

Please sign in to comment.