Remove using SortType and using Mode from TopK

This commit is contained in:
Mateusz Tabaka 2020-11-03 11:12:38 +01:00
parent a7c8365446
commit ee2f99ea89
19 changed files with 120 additions and 123 deletions

View File

@ -158,7 +158,7 @@ TEST(ConvertFunctionToCNNNetworkTests, ConvertTopKWithOneInput) {
ngraph::Shape const_shape = {}; ngraph::Shape const_shape = {};
std::vector<int64_t> val = {5}; std::vector<int64_t> val = {5};
auto k = std::make_shared<ngraph::opset4::Constant>(ngraph::element::i64, const_shape, val); auto k = std::make_shared<ngraph::opset4::Constant>(ngraph::element::i64, const_shape, val);
auto topK = std::make_shared<ngraph::opset4::TopK>(param, k, 2, ngraph::opset4::TopK::Mode::MAX, ngraph::opset4::TopK::SortType::SORT_VALUES); auto topK = std::make_shared<ngraph::opset4::TopK>(param, k, 2, ngraph::op::TopKMode::MAX, ngraph::op::TopKSortType::SORT_VALUES);
topK->set_friendly_name("topK"); topK->set_friendly_name("topK");
auto result = std::make_shared<ngraph::op::Result>(topK->output(1)); auto result = std::make_shared<ngraph::op::Result>(topK->output(1));

View File

@ -258,7 +258,7 @@ TEST(algebraic_simplification, replace_transpose_with_reshape) {
k = make_shared<op::Constant>(element::i64, Shape{}, std::vector<int64_t>{shape[last_dim].get_length()}); k = make_shared<op::Constant>(element::i64, Shape{}, std::vector<int64_t>{shape[last_dim].get_length()});
} }
A1 = make_shared<op::v1::TopK>(param, k, last_dim, A1 = make_shared<op::v1::TopK>(param, k, last_dim,
op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::NONE); op::TopKMode::MAX, op::TopKSortType::NONE);
} else { } else {
A1 = make_shared<op::v0::Abs>(param); A1 = make_shared<op::v0::Abs>(param);
} }
@ -350,7 +350,7 @@ TEST(algebraic_simplification, gather_3d_indices_constant_axis_1) {
shared_ptr<Node> A1; shared_ptr<Node> A1;
if (multiout) { if (multiout) {
auto last_dim = pshape.rank().get_length() - 1; auto last_dim = pshape.rank().get_length() - 1;
A1 = make_shared<op::v1::TopK>(A, op::Constant::create(element::i64, {}, {1}), last_dim, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::NONE); A1 = make_shared<op::v1::TopK>(A, op::Constant::create(element::i64, {}, {1}), last_dim, op::TopKMode::MAX, op::TopKSortType::NONE);
} else { } else {
A1 = make_shared<op::v0::Abs>(A); A1 = make_shared<op::v0::Abs>(A);
} }

View File

@ -277,7 +277,7 @@ TEST(nop_elimination, squeeze_unsqueeze_overlap_elimination) {
} else { } else {
k = make_shared<op::Constant>(element::i64, Shape{}, std::vector<int64_t>{shape[last_dim].get_length()}); k = make_shared<op::Constant>(element::i64, Shape{}, std::vector<int64_t>{shape[last_dim].get_length()});
} }
A1 = make_shared<op::v1::TopK>(A, k, last_dim, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::NONE); A1 = make_shared<op::v1::TopK>(A, k, last_dim, op::TopKMode::MAX, op::TopKSortType::NONE);
} else { } else {
A1 = make_shared<op::v0::Abs>(A); A1 = make_shared<op::v0::Abs>(A);
} }
@ -748,7 +748,7 @@ TEST(nop_elimination, topk_convert_elimination) {
auto check_usecase = []() { auto check_usecase = []() {
auto A = make_shared<op::Parameter>(element::f32, Shape{20, 3, 4}); auto A = make_shared<op::Parameter>(element::f32, Shape{20, 3, 4});
auto A1 = make_shared<op::v0::Abs>(A); auto A1 = make_shared<op::v0::Abs>(A);
auto B = make_shared<op::v1::TopK>(A1, op::Constant::create(element::i64, {}, {10}), 0, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::NONE); auto B = make_shared<op::v1::TopK>(A1, op::Constant::create(element::i64, {}, {10}), 0, op::TopKMode::MAX, op::TopKSortType::NONE);
auto C = make_shared<op::Convert>(B->output(0), B->output(0).get_element_type()); auto C = make_shared<op::Convert>(B->output(0), B->output(0).get_element_type());
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(C), ParameterVector{A}); auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(C), ParameterVector{A});
auto optimized_f = clone_function(*baseline_f); auto optimized_f = clone_function(*baseline_f);

View File

@ -92,8 +92,8 @@ protected:
// TopK // TopK
const auto k = make_shared<op::Constant>(element::i32, Shape{}, vector<int>{1}); const auto k = make_shared<op::Constant>(element::i32, Shape{}, vector<int>{1});
size_t axis = 1; size_t axis = 1;
ngraph::op::v1::TopK::Mode mode = ngraph::op::v1::TopK::Mode::MAX; ngraph::op::TopKMode mode = ngraph::op::TopKMode::MAX;
ngraph::op::v1::TopK::SortType sort = ngraph::op::v1::TopK::SortType::NONE; ngraph::op::TopKSortType sort = ngraph::op::TopKSortType::NONE;
auto argmaxNode = std::make_shared<opset1::TopK>(convNode, k, axis, mode, sort); auto argmaxNode = std::make_shared<opset1::TopK>(convNode, k, axis, mode, sort);
argmaxNode->set_friendly_name("TopK_1"); argmaxNode->set_friendly_name("TopK_1");

View File

@ -27,15 +27,15 @@ const std::vector<int64_t> k = {
10, 10,
}; };
const std::vector<ngraph::opset4::TopK::Mode> modes = { const std::vector<ngraph::op::TopKMode> modes = {
ngraph::opset4::TopK::Mode::MIN, ngraph::op::TopKMode::MIN,
ngraph::opset4::TopK::Mode::MAX ngraph::op::TopKMode::MAX
}; };
const std::vector<ngraph::opset4::TopK::SortType> sortTypes = { const std::vector<ngraph::op::TopKSortType> sortTypes = {
ngraph::opset4::TopK::SortType::NONE, ngraph::op::TopKSortType::NONE,
ngraph::opset4::TopK::SortType::SORT_INDICES, ngraph::op::TopKSortType::SORT_INDICES,
ngraph::opset4::TopK::SortType::SORT_VALUES, ngraph::op::TopKSortType::SORT_VALUES,
}; };

View File

@ -27,15 +27,15 @@ const std::vector<int64_t> k = {
10, 10,
}; };
const std::vector<ngraph::opset4::TopK::Mode> modes = { const std::vector<ngraph::op::TopKMode> modes = {
ngraph::opset4::TopK::Mode::MIN, ngraph::op::TopKMode::MIN,
ngraph::opset4::TopK::Mode::MAX ngraph::op::TopKMode::MAX
}; };
const std::vector<ngraph::opset4::TopK::SortType> sortTypes = { const std::vector<ngraph::op::TopKSortType> sortTypes = {
ngraph::opset4::TopK::SortType::NONE, ngraph::op::TopKSortType::NONE,
ngraph::opset4::TopK::SortType::SORT_INDICES, ngraph::op::TopKSortType::SORT_INDICES,
ngraph::opset4::TopK::SortType::SORT_VALUES, ngraph::op::TopKSortType::SORT_VALUES,
}; };

View File

@ -27,14 +27,14 @@ const std::vector<int64_t> k = {
10, 10,
}; };
const std::vector<ngraph::opset5::TopK::Mode> modes = { const std::vector<ngraph::op::TopKMode> modes = {
ngraph::opset5::TopK::Mode::MIN, ngraph::op::TopKMode::MIN,
ngraph::opset5::TopK::Mode::MAX ngraph::op::TopKMode::MAX
}; };
const std::vector<ngraph::opset5::TopK::SortType> sortTypes = { const std::vector<ngraph::op::TopKSortType> sortTypes = {
ngraph::opset5::TopK::SortType::SORT_INDICES, ngraph::op::TopKSortType::SORT_INDICES,
ngraph::opset5::TopK::SortType::SORT_VALUES, ngraph::op::TopKSortType::SORT_VALUES,
}; };
INSTANTIATE_TEST_CASE_P(smoke_TopK_IndicesValuesSort, TopKLayerTest, INSTANTIATE_TEST_CASE_P(smoke_TopK_IndicesValuesSort, TopKLayerTest,
@ -56,7 +56,7 @@ INSTANTIATE_TEST_CASE_P(smoke_TopK_NoneSort, TopKLayerTest,
::testing::Values(1), ::testing::Values(1),
::testing::ValuesIn(axes), ::testing::ValuesIn(axes),
::testing::ValuesIn(modes), ::testing::ValuesIn(modes),
::testing::Values(ngraph::opset5::TopK::SortType::NONE), ::testing::Values(ngraph::op::TopKSortType::NONE),
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED), ::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED), ::testing::Values(InferenceEngine::Precision::UNSPECIFIED),

View File

@ -14,8 +14,8 @@ namespace LayerTestsDefinitions {
typedef std::tuple< typedef std::tuple<
int64_t, // keepK int64_t, // keepK
int64_t, // axis int64_t, // axis
ngraph::opset4::TopK::Mode, // mode ngraph::op::TopKMode, // mode
ngraph::opset4::TopK::SortType, // sort ngraph::op::TopKSortType, // sort
InferenceEngine::Precision, // Net precision InferenceEngine::Precision, // Net precision
InferenceEngine::Precision, // Input precision InferenceEngine::Precision, // Input precision
InferenceEngine::Precision, // Output precision InferenceEngine::Precision, // Output precision

View File

@ -12,8 +12,8 @@ namespace LayerTestsDefinitions {
InferenceEngine::SizeVector inputShape; InferenceEngine::SizeVector inputShape;
std::string targetDevice; std::string targetDevice;
int64_t keepK, axis; int64_t keepK, axis;
ngraph::opset4::TopK::Mode mode; ngraph::op::TopKMode mode;
ngraph::opset4::TopK::SortType sort; ngraph::op::TopKSortType sort;
std::tie(keepK, axis, mode, sort, netPrecision, inPrc, outPrc, inLayout, inputShape, targetDevice) = obj.param; std::tie(keepK, axis, mode, sort, netPrecision, inPrc, outPrc, inLayout, inputShape, targetDevice) = obj.param;
std::ostringstream result; std::ostringstream result;
result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_"; result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_";
@ -33,8 +33,8 @@ void TopKLayerTest::SetUp() {
InferenceEngine::SizeVector inputShape; InferenceEngine::SizeVector inputShape;
InferenceEngine::Precision netPrecision; InferenceEngine::Precision netPrecision;
int64_t keepK, axis; int64_t keepK, axis;
ngraph::opset4::TopK::Mode mode; ngraph::op::TopKMode mode;
ngraph::opset4::TopK::SortType sort; ngraph::op::TopKSortType sort;
std::tie(keepK, axis, mode, sort, netPrecision, inPrc, outPrc, inLayout, inputShape, targetDevice) = this->GetParam(); std::tie(keepK, axis, mode, sort, netPrecision, inPrc, outPrc, inLayout, inputShape, targetDevice) = this->GetParam();
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);

View File

@ -33,9 +33,6 @@ namespace ngraph
class NGRAPH_API TopK : public Op class NGRAPH_API TopK : public Op
{ {
public: public:
using SortType = TopKSortType;
using Mode = TopKMode;
static constexpr NodeTypeInfo type_info{"TopK", 1}; static constexpr NodeTypeInfo type_info{"TopK", 1};
const NodeTypeInfo& get_type_info() const override { return type_info; } const NodeTypeInfo& get_type_info() const override { return type_info; }
/// \brief Constructs a TopK operation /// \brief Constructs a TopK operation
@ -62,8 +59,8 @@ namespace ngraph
TopK(const Output<Node>& data, TopK(const Output<Node>& data,
const Output<Node>& k, const Output<Node>& k,
const int64_t axis, const int64_t axis,
const Mode mode, const op::TopKMode mode,
const SortType sort, const op::TopKSortType sort,
const element::Type& index_element_type = element::i32); const element::Type& index_element_type = element::i32);
bool visit_attributes(AttributeVisitor& visitor) override; bool visit_attributes(AttributeVisitor& visitor) override;
@ -80,10 +77,10 @@ namespace ngraph
/// \brief Returns axis value before normalization /// \brief Returns axis value before normalization
int64_t get_provided_axis() const { return m_axis; } int64_t get_provided_axis() const { return m_axis; }
void set_axis(const int64_t axis); void set_axis(const int64_t axis);
Mode get_mode() const { return m_mode; } op::TopKMode get_mode() const { return m_mode; }
void set_mode(const Mode mode) { m_mode = mode; } void set_mode(const op::TopKMode mode) { m_mode = mode; }
SortType get_sort_type() const { return m_sort; } op::TopKSortType get_sort_type() const { return m_sort; }
void set_sort_type(const SortType sort) { m_sort = sort; } void set_sort_type(const op::TopKSortType sort) { m_sort = sort; }
element::Type get_index_element_type() const { return m_index_element_type; } element::Type get_index_element_type() const { return m_index_element_type; }
void set_index_element_type(const element::Type& index_element_type) void set_index_element_type(const element::Type& index_element_type)
{ {
@ -102,8 +99,8 @@ namespace ngraph
protected: protected:
int64_t m_axis; int64_t m_axis;
uint64_t m_normalized_axis; uint64_t m_normalized_axis;
Mode m_mode; op::TopKMode m_mode;
SortType m_sort; op::TopKSortType m_sort;
element::Type m_index_element_type{element::i32}; element::Type m_index_element_type{element::i32};
virtual size_t read_k_from_constant_node(const std::shared_ptr<Node>& node, virtual size_t read_k_from_constant_node(const std::shared_ptr<Node>& node,
@ -151,8 +148,8 @@ namespace ngraph
TopK(const Output<Node>& data, TopK(const Output<Node>& data,
const Output<Node>& k, const Output<Node>& k,
const int64_t axis, const int64_t axis,
const Mode mode, const op::TopKMode mode,
const SortType sort, const op::TopKSortType sort,
const element::Type& index_element_type = element::i32); const element::Type& index_element_type = element::i32);
bool visit_attributes(AttributeVisitor& visitor) override; bool visit_attributes(AttributeVisitor& visitor) override;
void validate_and_infer_types() override; void validate_and_infer_types() override;

View File

@ -80,7 +80,7 @@ namespace ngraph
size_t axis, size_t axis,
size_t k, size_t k,
bool compute_max, bool compute_max,
op::v1::TopK::SortType sort = op::v1::TopK::SortType::NONE) op::TopKSortType sort = op::TopKSortType::NONE)
{ {
using namespace std; using namespace std;
// reorder source axis visit order and make "axis" inner most // reorder source axis visit order and make "axis" inner most
@ -137,13 +137,13 @@ namespace ngraph
{ {
switch (sort) switch (sort)
{ {
case op::v1::TopK::SortType::NONE: break; case op::TopKSortType::NONE: break;
case op::v1::TopK::SortType::SORT_INDICES: case op::TopKSortType::SORT_INDICES:
std::sort(workspace.begin(), std::sort(workspace.begin(),
workspace.begin() + k, workspace.begin() + k,
sort_indices_descending<T, U>); sort_indices_descending<T, U>);
break; break;
case op::v1::TopK::SortType::SORT_VALUES: case op::TopKSortType::SORT_VALUES:
std::sort(workspace.begin(), workspace.begin() + k, compare_max<T, U>); std::sort(workspace.begin(), workspace.begin() + k, compare_max<T, U>);
break; break;
} }
@ -152,13 +152,13 @@ namespace ngraph
{ {
switch (sort) switch (sort)
{ {
case op::v1::TopK::SortType::NONE: break; case op::TopKSortType::NONE: break;
case op::v1::TopK::SortType::SORT_INDICES: case op::TopKSortType::SORT_INDICES:
std::sort(workspace.begin(), std::sort(workspace.begin(),
workspace.begin() + k, workspace.begin() + k,
sort_indices_ascending<T, U>); sort_indices_ascending<T, U>);
break; break;
case op::v1::TopK::SortType::SORT_VALUES: case op::TopKSortType::SORT_VALUES:
std::sort(workspace.begin(), workspace.begin() + k, compare_min<T, U>); std::sort(workspace.begin(), workspace.begin() + k, compare_min<T, U>);
break; break;
} }

View File

@ -41,7 +41,7 @@ namespace topk
const size_t axis, const size_t axis,
const size_t k, const size_t k,
const bool compute_max, const bool compute_max,
const op::v1::TopK::SortType sort) const op::TopKSortType sort)
{ {
using T = typename element_type_traits<INPUT_ET>::value_type; using T = typename element_type_traits<INPUT_ET>::value_type;
using U = typename element_type_traits<INDEX_ET>::value_type; using U = typename element_type_traits<INDEX_ET>::value_type;
@ -72,7 +72,7 @@ namespace topk
const size_t axis, const size_t axis,
const size_t k, const size_t k,
const bool max, const bool max,
const op::v1::TopK::SortType sort, const op::TopKSortType sort,
const element::Type index_et) const element::Type index_et)
{ {
bool rc = true; bool rc = true;
@ -98,7 +98,7 @@ namespace topk
const size_t axis, const size_t axis,
const size_t k, const size_t k,
const bool max, const bool max,
const op::v1::TopK::SortType sort, const op::TopKSortType sort,
const element::Type index_et) const element::Type index_et)
{ {
bool rc = true; bool rc = true;
@ -177,8 +177,8 @@ op::v1::TopK::TopK(const Output<Node>& data,
: Op{{data, k}} : Op{{data, k}}
, m_axis{axis} , m_axis{axis}
, m_normalized_axis{UNKNOWN_NORMALIZED_AXIS} , m_normalized_axis{UNKNOWN_NORMALIZED_AXIS}
, m_mode{as_enum<Mode>(mode)} , m_mode{as_enum<op::TopKMode>(mode)}
, m_sort{as_enum<SortType>(sort)} , m_sort{as_enum<op::TopKSortType>(sort)}
, m_index_element_type{index_element_type} , m_index_element_type{index_element_type}
{ {
constructor_validate_and_infer_types(); constructor_validate_and_infer_types();
@ -187,8 +187,8 @@ op::v1::TopK::TopK(const Output<Node>& data,
op::v1::TopK::TopK(const Output<Node>& data, op::v1::TopK::TopK(const Output<Node>& data,
const Output<Node>& k, const Output<Node>& k,
const int64_t axis, const int64_t axis,
const Mode mode, const op::TopKMode mode,
const SortType sort, const op::TopKSortType sort,
const element::Type& index_element_type) const element::Type& index_element_type)
: Op{{data, k}} : Op{{data, k}}
, m_axis{axis} , m_axis{axis}
@ -404,8 +404,8 @@ bool op::v1::TopK::evaluate(const HostTensorVector& outputs, const HostTensorVec
Shape arg_shape = inputs[0]->get_shape(); Shape arg_shape = inputs[0]->get_shape();
// 1. get axis, mode ( max/min), sort_type // 1. get axis, mode ( max/min), sort_type
size_t axis = ngraph::normalize_axis(this, m_axis, arg_shape.size()); size_t axis = ngraph::normalize_axis(this, m_axis, arg_shape.size());
bool compute_max = get_mode() == TopKMode::MAX ? true : false; bool compute_max = get_mode() == op::TopKMode::MAX ? true : false;
SortType sort_type = get_sort_type(); op::TopKSortType sort_type = get_sort_type();
// 2. get value of k - from constant node or from HT // 2. get value of k - from constant node or from HT
size_t k = 0; size_t k = 0;
@ -458,8 +458,8 @@ op::v3::TopK::TopK(const Output<Node>& data,
op::v3::TopK::TopK(const Output<Node>& data, op::v3::TopK::TopK(const Output<Node>& data,
const Output<Node>& k, const Output<Node>& k,
const int64_t axis, const int64_t axis,
const Mode mode, const op::TopKMode mode,
const SortType sort, const op::TopKSortType sort,
const element::Type& index_element_type) const element::Type& index_element_type)
: op::v1::TopK{data, k, axis, mode, sort, index_element_type} : op::v1::TopK{data, k, axis, mode, sort, index_element_type}
{ {

View File

@ -45,7 +45,7 @@ namespace ngraph
private: private:
std::shared_ptr<ngraph::Node> std::shared_ptr<ngraph::Node>
make_topk_subgraph(default_opset::TopK::Mode mode) const; make_topk_subgraph(op::TopKMode mode) const;
const std::int64_t m_keep_dims; const std::int64_t m_keep_dims;
Output<ngraph::Node> m_input_node; Output<ngraph::Node> m_input_node;

View File

@ -59,8 +59,8 @@ namespace ngraph
coerced_tensor, coerced_tensor,
default_opset::Constant::create(ngraph::element::i64, Shape{}, {1}), default_opset::Constant::create(ngraph::element::i64, Shape{}, {1}),
indices_axis, indices_axis,
default_opset::TopK::Mode::MAX, ngraph::op::TopKMode::MAX,
default_opset::TopK::SortType::NONE); ngraph::op::TopKSortType::NONE);
const auto on_value = const auto on_value =
default_opset::Constant::create(ngraph::element::i64, Shape{}, {1}); default_opset::Constant::create(ngraph::element::i64, Shape{}, {1});

View File

@ -70,8 +70,8 @@ namespace ngraph
data, data,
k_node, k_node,
axis, axis,
default_opset::TopK::Mode::MAX, ngraph::op::TopKMode::MAX,
default_opset::TopK::SortType::SORT_VALUES, ngraph::op::TopKSortType::SORT_VALUES,
element::i64); element::i64);
return {top_k->output(0), top_k->output(1)}; return {top_k->output(0), top_k->output(1)};
@ -90,8 +90,8 @@ namespace ngraph
data, data,
k, k,
axis, axis,
default_opset::TopK::Mode::MAX, ngraph::op::TopKMode::MAX,
default_opset::TopK::SortType::SORT_VALUES, ngraph::op::TopKSortType::SORT_VALUES,
element::i64); element::i64);
return {top_k->output(0), top_k->output(1)}; return {top_k->output(0), top_k->output(1)};
@ -112,12 +112,12 @@ namespace ngraph
const auto sorted = node.get_attribute_value<std::int64_t>("sorted", 1); const auto sorted = node.get_attribute_value<std::int64_t>("sorted", 1);
// Map attribute values to nGraph enums // Map attribute values to nGraph enums
const auto sort_type = sorted ? default_opset::TopK::SortType::SORT_VALUES const auto sort_type = sorted ? ngraph::op::TopKSortType::SORT_VALUES
: default_opset::TopK::SortType::NONE; : ngraph::op::TopKSortType::NONE;
const auto compute_max = static_cast<bool>(largest); const auto compute_max = static_cast<bool>(largest);
const auto mode = compute_max ? default_opset::TopK::Mode::MAX const auto mode = compute_max ? ngraph::op::TopKMode::MAX
: default_opset::TopK::Mode::MIN; : ngraph::op::TopKMode::MIN;
std::shared_ptr<ngraph::Node> top_k = std::make_shared<default_opset::TopK>( std::shared_ptr<ngraph::Node> top_k = std::make_shared<default_opset::TopK>(
data, k, axis, mode, sort_type, element::i64); data, k, axis, mode, sort_type, element::i64);

View File

@ -33,21 +33,21 @@ namespace ngraph
std::shared_ptr<ngraph::Node> ArgMinMaxFactory::make_arg_max() const std::shared_ptr<ngraph::Node> ArgMinMaxFactory::make_arg_max() const
{ {
return make_topk_subgraph(default_opset::TopK::Mode::MAX); return make_topk_subgraph(ngraph::op::TopKMode::MAX);
} }
std::shared_ptr<ngraph::Node> ArgMinMaxFactory::make_arg_min() const std::shared_ptr<ngraph::Node> ArgMinMaxFactory::make_arg_min() const
{ {
return make_topk_subgraph(default_opset::TopK::Mode::MIN); return make_topk_subgraph(ngraph::op::TopKMode::MIN);
} }
std::shared_ptr<ngraph::Node> std::shared_ptr<ngraph::Node>
ArgMinMaxFactory::make_topk_subgraph(default_opset::TopK::Mode mode) const ArgMinMaxFactory::make_topk_subgraph(ngraph::op::TopKMode mode) const
{ {
const auto k_node = const auto k_node =
default_opset::Constant::create(ngraph::element::i64, Shape{}, {1}); default_opset::Constant::create(ngraph::element::i64, Shape{}, {1});
const auto topk = std::make_shared<default_opset::TopK>( const auto topk = std::make_shared<default_opset::TopK>(
m_input_node, k_node, m_axis, mode, default_opset::TopK::SortType::NONE); m_input_node, k_node, m_axis, mode, ngraph::op::TopKSortType::NONE);
if (m_keep_dims == 0) if (m_keep_dims == 0)
{ {

View File

@ -1257,8 +1257,8 @@ TEST(attributes, topk_op)
auto k = make_shared<op::Parameter>(element::i32, Shape{}); auto k = make_shared<op::Parameter>(element::i32, Shape{});
auto axis = 0; auto axis = 0;
auto mode = opset1::TopK::Mode::MAX; auto mode = op::TopKMode::MAX;
auto sort_type = opset1::TopK::SortType::SORT_VALUES; auto sort_type = op::TopKSortType::SORT_VALUES;
auto topk = make_shared<opset1::TopK>(data, k, axis, mode, sort_type); auto topk = make_shared<opset1::TopK>(data, k, axis, mode, sort_type);
NodeBuilder builder(topk); NodeBuilder builder(topk);

View File

@ -65,13 +65,13 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_resnet50)
auto B = make_shared<op::v1::TopK>(A, auto B = make_shared<op::v1::TopK>(A,
op::Constant::create(element::i64, {}, {5}), op::Constant::create(element::i64, {}, {5}),
1, 1,
op::v1::TopK::Mode::MAX, op::TopKMode::MAX,
op::v1::TopK::SortType::SORT_VALUES); op::TopKSortType::SORT_VALUES);
auto C = make_shared<op::v1::TopK>(A, auto C = make_shared<op::v1::TopK>(A,
op::Constant::create(element::i64, {}, {1}), op::Constant::create(element::i64, {}, {1}),
1, 1,
op::v1::TopK::Mode::MAX, op::TopKMode::MAX,
op::v1::TopK::SortType::SORT_VALUES); op::TopKSortType::SORT_VALUES);
auto out5_value = B->output(0); auto out5_value = B->output(0);
auto out5_index = B->output(1); auto out5_index = B->output(1);
@ -143,7 +143,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_max_sort_none)
auto k = op::Constant::create(element::i64, {}, {5}); auto k = op::Constant::create(element::i64, {}, {5});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::NONE); A, k, axis, op::TopKMode::MAX, op::TopKSortType::NONE);
auto out_value = B->output(0); auto out_value = B->output(0);
auto out_index = B->output(1); auto out_index = B->output(1);
auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A}); auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A});
@ -197,7 +197,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_min_sort_none)
auto k = op::Constant::create(element::i64, {}, {5}); auto k = op::Constant::create(element::i64, {}, {5});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::NONE); A, k, axis, op::TopKMode::MIN, op::TopKSortType::NONE);
auto out_value = B->output(0); auto out_value = B->output(0);
auto out_index = B->output(1); auto out_index = B->output(1);
auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A}); auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A});
@ -251,7 +251,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_max_sort_value)
auto k = op::Constant::create(element::i64, {}, {5}); auto k = op::Constant::create(element::i64, {}, {5});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto out_value = B->output(0); auto out_value = B->output(0);
auto out_index = B->output(1); auto out_index = B->output(1);
auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A}); auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A});
@ -301,7 +301,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_min_sort_value)
auto k = op::Constant::create(element::i64, {}, {5}); auto k = op::Constant::create(element::i64, {}, {5});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto out_value = B->output(0); auto out_value = B->output(0);
auto out_index = B->output(1); auto out_index = B->output(1);
auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A}); auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A});
@ -355,7 +355,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_max_sort_index)
auto k = op::Constant::create(element::i64, {}, {5}); auto k = op::Constant::create(element::i64, {}, {5});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_INDICES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_INDICES);
auto out_value = B->output(0); auto out_value = B->output(0);
auto out_index = B->output(1); auto out_index = B->output(1);
auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A}); auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A});
@ -409,7 +409,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_min_sort_index)
auto k = op::Constant::create(element::i64, {}, {5}); auto k = op::Constant::create(element::i64, {}, {5});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_INDICES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_INDICES);
auto out_value = B->output(0); auto out_value = B->output(0);
auto out_index = B->output(1); auto out_index = B->output(1);
auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A}); auto f = make_shared<Function>(OutputVector{out_value, out_index}, ParameterVector{A});
@ -463,7 +463,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_max_all)
auto k = op::Constant::create(element::i64, {}, {6}); auto k = op::Constant::create(element::i64, {}, {6});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -492,7 +492,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_i32_max_all)
auto k = op::Constant::create(element::i64, {}, {6}); auto k = op::Constant::create(element::i64, {}, {6});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -520,7 +520,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_max_partial)
auto k = op::Constant::create(element::i64, {}, {3}); auto k = op::Constant::create(element::i64, {}, {3});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -549,7 +549,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_max_one)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -578,7 +578,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_min_all)
auto k = op::Constant::create(element::i64, {}, {6}); auto k = op::Constant::create(element::i64, {}, {6});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -607,7 +607,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_min_partial)
auto k = op::Constant::create(element::i64, {}, {3}); auto k = op::Constant::create(element::i64, {}, {3});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -636,7 +636,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_1d_min_one)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -665,7 +665,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_max_all)
auto k = op::Constant::create(element::i64, {}, {3}); auto k = op::Constant::create(element::i64, {}, {3});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -695,7 +695,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_int64)
auto k = op::Constant::create(element::i64, {}, {3}); auto k = op::Constant::create(element::i64, {}, {3});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES, element::i64); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES, element::i64);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -725,7 +725,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_5d_max_partial)
auto k = op::Constant::create(element::i64, {}, {2}); auto k = op::Constant::create(element::i64, {}, {2});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -791,7 +791,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_max_partial)
auto k = op::Constant::create(element::i64, {}, {2}); auto k = op::Constant::create(element::i64, {}, {2});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -821,7 +821,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_max_one)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -850,7 +850,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_min_all)
auto k = op::Constant::create(element::i64, {}, {3}); auto k = op::Constant::create(element::i64, {}, {3});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -880,7 +880,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_min_partial)
auto k = op::Constant::create(element::i64, {}, {2}); auto k = op::Constant::create(element::i64, {}, {2});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -910,7 +910,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_min_one)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -939,7 +939,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_max_all)
auto k = op::Constant::create(element::i64, {}, {4}); auto k = op::Constant::create(element::i64, {}, {4});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -969,7 +969,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_max_partial)
auto k = op::Constant::create(element::i64, {}, {2}); auto k = op::Constant::create(element::i64, {}, {2});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -999,7 +999,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_max_one)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1028,7 +1028,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_max_one_with_equal_values)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1057,7 +1057,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_min_all)
auto k = op::Constant::create(element::i64, {}, {4}); auto k = op::Constant::create(element::i64, {}, {4});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1087,7 +1087,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_min_partial)
auto k = op::Constant::create(element::i64, {}, {2}); auto k = op::Constant::create(element::i64, {}, {2});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1116,7 +1116,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_2d_min_one)
auto k = op::Constant::create(element::i64, {}, {1}); auto k = op::Constant::create(element::i64, {}, {1});
int64_t axis = 0; int64_t axis = 0;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::NONE); A, k, axis, op::TopKMode::MIN, op::TopKSortType::NONE);
auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1145,7 +1145,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_large_input_max)
auto k = op::Constant::create(element::i64, {}, {10}); auto k = op::Constant::create(element::i64, {}, {10});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES);
auto interp_f_0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto interp_f_0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto interp_f_1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto interp_f_1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1185,7 +1185,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_large_input_min)
auto k = op::Constant::create(element::i64, {}, {10}); auto k = op::Constant::create(element::i64, {}, {10});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto interp_f_0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A}); auto interp_f_0 = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A});
auto interp_f_1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto interp_f_1 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
@ -1225,7 +1225,7 @@ NGRAPH_TEST(${BACKEND_NAME}, topk_3d_single_output)
auto k = op::Constant::create(element::i64, {}, {2}); auto k = op::Constant::create(element::i64, {}, {2});
int64_t axis = 1; int64_t axis = 1;
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MIN, op::v1::TopK::SortType::SORT_VALUES); A, k, axis, op::TopKMode::MIN, op::TopKSortType::SORT_VALUES);
auto f0 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A}); auto f0 = make_shared<Function>(OutputVector{B->output(1)}, ParameterVector{A});
auto backend = runtime::Backend::create("${BACKEND_NAME}"); auto backend = runtime::Backend::create("${BACKEND_NAME}");

View File

@ -1675,7 +1675,7 @@ TEST(eval, topk_v1_dyn_k0)
element::Type result_et{element::i32}; element::Type result_et{element::i32};
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, 1, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES, result_et); A, k, 1, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES, result_et);
auto fun = auto fun =
make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A, k}); make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A, k});
@ -1764,7 +1764,7 @@ TEST(eval, topk_v1_param_dyn_k2)
element::Type result_et{element::i32}; element::Type result_et{element::i32};
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, axis, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES, result_et); A, k, axis, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES, result_et);
auto fun = auto fun =
make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A, k}); make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A, k});
@ -1797,7 +1797,7 @@ TEST(eval, topk_v1_param_dyn_k0)
element::Type result_et{element::i32}; element::Type result_et{element::i32};
auto B = make_shared<op::v1::TopK>( auto B = make_shared<op::v1::TopK>(
A, k, 1, op::v1::TopK::Mode::MAX, op::v1::TopK::SortType::SORT_VALUES, result_et); A, k, 1, op::TopKMode::MAX, op::TopKSortType::SORT_VALUES, result_et);
auto fun = auto fun =
make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A, k}); make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A, k});