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

Get rid of legacy builders #811

Merged
merged 3 commits into from
Jan 5, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -8,12 +8,11 @@

#include <ie_precision.hpp>
#include <ngraph/node.hpp>
#include "openvino/opsets/opset1.hpp"
#include <vector>

#include "cuda_test_constants.hpp"
#include "finite_comparer.hpp"
#include "ov_models/builders.hpp"
#include "openvino/opsets/opset1.hpp"

using namespace LayerTestsDefinitions;

Expand Down Expand Up @@ -159,17 +158,9 @@ class ConvolutionBackpropDataExtendedLayerTest

auto outputShapeNode = std::make_shared<ov::op::v0::Constant>(
ov::element::Type_t::i64, ov::Shape{outputShapeData.size()}, outputShapeData);
auto convBackpropData = std::dynamic_pointer_cast<ov::opset1::ConvolutionBackpropData>(
makeConvolutionBackpropData(params[0],
outputShapeNode,
ngPrc,
kernel,
stride,
padBegin,
padEnd,
dilation,
padType,
convOutChannels));
auto convBackpropData = std::dynamic_pointer_cast<
ov::opset1::ConvolutionBackpropData>(makeConvolutionBackpropData(
params[0], outputShapeNode, ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels));
ov::ResultVector results{std::make_shared<ov::opset1::Result>(convBackpropData)};
function = std::make_shared<ngraph::Function>(results, params, "convolutionBackpropData");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

#include <ie_precision.hpp>
#include <ngraph/node.hpp>
#include "openvino/opsets/opset1.hpp"
#include <vector>

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

using namespace LayerTestsDefinitions;
Expand Down Expand Up @@ -157,17 +156,9 @@ class ConvolutionBackpropDataAddExtendedLayerTest

auto outputShapeNode = std::make_shared<ov::op::v0::Constant>(
ov::element::Type_t::i64, ov::Shape{outputShapeData.size()}, outputShapeData);
auto convBackpropData = std::dynamic_pointer_cast<ov::opset1::ConvolutionBackpropData>(
makeConvolutionBackpropData(params[0],
outputShapeNode,
ngPrc,
kernel,
stride,
padBegin,
padEnd,
dilation,
padType,
convOutChannels));
auto convBackpropData = std::dynamic_pointer_cast<
ov::opset1::ConvolutionBackpropData>(makeConvolutionBackpropData(
params[0], outputShapeNode, ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, convOutChannels));

ov::Tensor random_tensor(ngPrc, outputShapeData);
ov::test::utils::fill_tensor_random(random_tensor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
#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>
#include <ov_models/utils/ov_helpers.hpp>
#include <shared_test_classes/base/layer_test_utils.hpp>
#include <shared_test_classes/single_layer/activation.hpp>
#include <shared_test_classes/single_layer/convolution.hpp>
Expand All @@ -30,6 +28,11 @@
#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"
#include "openvino/opsets/opset1.hpp"

namespace LayerTestsDefinitions {
using ov::test::utils::ActivationTypes;

Expand Down Expand Up @@ -96,9 +99,7 @@ class BasicConvolutionBiasAddActivationLayerTest
std::ostringstream result;
result << TConvLayerTest::getTestCaseName({convParamSet, obj.index}) << "_";
result << "Activation="
<< (activation == ActivationTypes::None
? "None"
: LayerTestsDefinitions::activationNames[activation]);
<< (activation == ActivationTypes::None ? "None" : LayerTestsDefinitions::activationNames[activation]);
return result.str();
}

Expand Down Expand Up @@ -135,7 +136,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 +170,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,11 +20,13 @@
#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"
#include "ov_models/utils/data_utils.hpp"

namespace LayerTestsDefinitions {

namespace {
Expand Down Expand Up @@ -272,7 +274,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 @@ -8,6 +8,7 @@
#include <openvino/op/util/attr_types.hpp>
#include <vector>

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

using ov::test::utils::InputLayerType;
Expand Down Expand Up @@ -106,18 +107,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);
auto gru_sequence = 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 @@ -8,9 +8,11 @@
#include <functional>
#include <vector>

#include "common_test_utils/node_builders/constant.hpp"
#include "cuda/device_pointers.hpp"
#include "cuda_operation_registry.hpp"
#include "cuda_thread_context.hpp"
#include "openvino/op/constant.hpp"
#include "unsymmetrical_comparer.hpp"

namespace LayerTestsDefinitions {
Expand All @@ -37,18 +39,17 @@ class CUDALSTMSequenceTest : public UnsymmetricalComparer<LSTMSequenceTest> {
}
};

using LSTMSequenceOptimizedParams =
typename std::tuple<SequenceTestsMode, // pure Sequence or TensorIterator
size_t, // seq_lengths
size_t, // batch
size_t, // hidden size
size_t, // input size
std::vector<std::string>, // activations
float, // clip
std::string, // major batch
InputLayerType, // WRB input type (Constant or Parameter)
InferenceEngine::Precision, // Network precision
std::string>; // Device name
using LSTMSequenceOptimizedParams = typename std::tuple<SequenceTestsMode, // pure Sequence or TensorIterator
size_t, // seq_lengths
size_t, // batch
size_t, // hidden size
size_t, // input size
std::vector<std::string>, // activations
float, // clip
std::string, // major batch
InputLayerType, // WRB input type (Constant or Parameter)
InferenceEngine::Precision, // Network precision
std::string>; // Device name

class CUDALSTMSequenceOptimizedTest : public testing::WithParamInterface<LSTMSequenceOptimizedParams>,
virtual public LayerTestsUtils::LayerTestsCommon {
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::deprecated::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::op::v0::Constant::create(ov::element::i64, input_shapes[3], lengths);
}
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::deprecated::make_constant(ngPrc, W_shape, {}, true, up_to, start_from, counter++);
R = ov::test::utils::deprecated::make_constant(ngPrc, R_shape, {}, true, up_to, start_from, counter++);
B = ov::test::utils::deprecated::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 @@ -11,13 +11,13 @@
#include <cuda_op_buffers_extractor.hpp>
#include <cuda_operation_registry.hpp>
#include <cuda_simple_execution_delegator.hpp>
#include <ngraph/node.hpp>
#include <kernels/details/cuda_type_traits.hpp>
#include <openvino/op/constant.hpp>
#include <openvino/op/parameter.hpp>
#include <openvino/op/range.hpp>
#include <openvino/op/result.hpp>
#include <ops/parameter.hpp>

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

namespace {

using devptr_t = CUDA::DevicePointer<void*>;
Expand Down
Loading