Class ov::op::util::TopKBase#

class TopKBase : public ov::op::Op#

Subclassed by ov::op::v11::TopK, ov::op::v1::TopK, ov::op::v3::TopK

Public Functions

TopKBase(const Output<Node> &data, const Output<Node> &k, const int64_t axis, const std::string &mode, const std::string &sort, const element::Type &index_element_type = element::i32)#

The common base class for all TopK operator versions.

Parameters:
  • data – The input tensor

  • k – Specifies how many maximum/minimum elements should be computed

  • axis – The axis along which TopK should be computed

  • mode – Specifies whether the maximum or minimum elements are selected

  • sort – Specifies the order of output elements and/or indices Accepted values: none, index, value

  • index_element_type – Specifies the type of produced indices

virtual void validate_and_infer_types() override#

Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.

Throws if the node is invalid.

uint64_t get_axis() const#

Returns axis value after normalization.

Note

If input rank required to normalization is dynamic, the exception is thrown

inline int64_t get_provided_axis() const#

Returns axis value before normalization.

size_t get_k() const#

Returns the value of K, if available.

Note

If the second input to this op is a constant, the value is retrieved and returned. If the input is not constant(dynamic) this method returns 0

inline virtual size_t get_default_output_index() const override#

Returns the output of the default output, or throws if there is none.