pub struct ITopKLayer { /* private fields */ }Expand description
ITopKLayer
Layer that represents a TopK reduction.
This layer can accept both static and dynamic k. Static k can be set through the addTopK() API function, or accessed using the getK() and setK() functions after layer creation. For dynamic k, use the setInput() method to pass in k as a tensor with index 1, which overrides the static k value in calculations.
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.
Implementations§
Source§impl ITopKLayer
impl ITopKLayer
Sourcepub fn setOperation(self: Pin<&mut ITopKLayer>, op: TopKOperation)
pub fn setOperation(self: Pin<&mut ITopKLayer>, op: TopKOperation)
Set the operation for the layer.
See [getOperation()], TopKOperation
Sourcepub fn getOperation(self: &ITopKLayer) -> TopKOperation
pub fn getOperation(self: &ITopKLayer) -> TopKOperation
Get the operation for the layer.
See [setOperation()], TopKOperation
Sourcepub fn setK(self: Pin<&mut ITopKLayer>, k: i32)
pub fn setK(self: Pin<&mut ITopKLayer>, k: i32)
Set the static k value for the layer.
Currently only values up to 3840 are supported.
If a second input to this layer has been set, it will be reset to null by this method.
See [getK()]
Sourcepub fn getK(self: &ITopKLayer) -> i32
pub fn getK(self: &ITopKLayer) -> i32
Get the k value for the layer.
This function will return the static k value passed into addTopK(), or the value passed into setK().
If a second layer input is present and non-null, this function returns -1.
See [setK()]
Sourcepub fn setReduceAxes(self: Pin<&mut ITopKLayer>, reduceAxes: u32)
pub fn setReduceAxes(self: Pin<&mut ITopKLayer>, reduceAxes: u32)
Set which axes to reduce for the layer.
See [getReduceAxes()]
Sourcepub fn getReduceAxes(self: &ITopKLayer) -> u32
pub fn getReduceAxes(self: &ITopKLayer) -> u32
Get the axes to reduce for the layer.
See [setReduceAxes()]
Sourcepub fn setIndicesType(self: Pin<&mut ITopKLayer>, type_: DataType) -> bool
pub fn setIndicesType(self: Pin<&mut ITopKLayer>, type_: DataType) -> bool
Set the indices type for the layer.
typeThe DataType of the indices tensor.
true if set successfully, false otherwise.
Set the indices (the second output) type of the TopK layer. Valid values are DataType::kINT32 and DataType::kINT64, otherwise an error occurs and the type is not updated.
Sourcepub fn getIndicesType(self: &ITopKLayer) -> DataType
pub fn getIndicesType(self: &ITopKLayer) -> DataType
Return the TopK layer indices type.
indices type set during layer creation or by setIndicesType(). The return value is the indices type of the TopK layer. The default value is DataType::kINT32.