Remove legacy test util func (#24659)

### Details:
 - Remove legacy test util func
 - *...*

### Tickets:
 - [CVS-128261](https://jira.devtools.intel.com/browse/CVS-128261)
This commit is contained in:
Oleg Pipikin 2024-05-27 12:48:40 +02:00 committed by GitHub
parent 883211e483
commit 94f287a051
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 61 deletions

View File

@ -106,7 +106,7 @@ private:
const ov::element::Type precision = ov::element::f32;
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{input_shape})};
auto constant = ov::test::utils::deprecated::make_constant(precision, {4096, 1024}, std::vector<float>{}, true);
auto constant = ov::test::utils::make_constant(precision, ov::Shape{4096, 1024});
auto custom_op = std::make_shared<UnsupportedTestOperation>(constant);
ov::NodeVector results{custom_op};

View File

@ -51,7 +51,7 @@ std::shared_ptr<ov::Model> createModelWithUnknownNode() {
const ov::Shape input_shape = {1, 4096};
const ov::element::Type precision = ov::element::f32;
ov::ParameterVector params = {std::make_shared<ov::op::v0::Parameter>(precision, ov::Shape{input_shape})};
auto constant = ov::test::utils::deprecated::make_constant(precision, {4096, 1024}, std::vector<float>{}, true);
auto constant = ov::test::utils::make_constant(precision, ov::Shape{4096, 1024});
auto custom_op = std::make_shared<UnsupportedTestOp>(constant);
ov::NodeVector results{custom_op};

View File

@ -11,65 +11,6 @@
namespace ov {
namespace test {
namespace utils {
namespace deprecated {
// Legacy implementation
// Remove after transition to new one
template <typename T>
std::shared_ptr<ov::Node> make_constant(const ov::element::Type& type,
const std::vector<size_t>& shape,
const std::vector<T>& data,
bool random = false,
T up_to = 10,
T start_from = 1,
const int seed = 1) {
#define makeNode(TYPE) \
case TYPE: \
if (random) { \
return std::make_shared<ov::op::v0::Constant>( \
type, \
shape, \
generateVector<TYPE>(ov::shape_size(shape), \
ov::element_type_traits<TYPE>::value_type(up_to), \
ov::element_type_traits<TYPE>::value_type(start_from), \
seed)); \
} else { \
if (std::is_same<T, fundamental_type_for<TYPE>>::value) { \
return std::make_shared<ov::op::v0::Constant>(type, shape, data); \
} else { \
/* Convert std::vector<T> data to required type */ \
std::vector<fundamental_type_for<TYPE>> converted_data(data.size()); \
std::transform(data.cbegin(), data.cend(), converted_data.begin(), [](T e) { \
return static_cast<fundamental_type_for<TYPE>>(e); \
}); \
return std::make_shared<ov::op::v0::Constant>(type, shape, converted_data); \
} \
} \
break;
switch (type) {
makeNode(ov::element::bf16);
makeNode(ov::element::f16);
makeNode(ov::element::f32);
makeNode(ov::element::f64);
makeNode(ov::element::i8);
makeNode(ov::element::i16);
makeNode(ov::element::i32);
makeNode(ov::element::i64);
makeNode(ov::element::u8);
makeNode(ov::element::u16);
makeNode(ov::element::u32);
makeNode(ov::element::u64);
makeNode(ov::element::boolean);
makeNode(ov::element::nf4);
makeNode(ov::element::u4);
makeNode(ov::element::i4);
default:
throw std::runtime_error("Unhandled precision");
}
#undef makeNode
}
} // namespace deprecated
std::shared_ptr<ov::Node> make_constant(const ov::element::Type& type,
const ov::Shape& shape,
InputGenerateData in_data = InputGenerateData(1, 9, 1000, 1));