TensorLayout Class Reference

TensorLayout Class Reference#

4 min read time

Applies to Linux

rocCV: roccv::TensorLayout Class Reference
roccv::TensorLayout Class Reference

TensorLayout class. More...

#include <tensor_layout.hpp>

Public Member Functions

int32_t batch_index () const
 Index of the batch dimension specified by layout. E.g. returns 0 for TENSOR_LAYOUT_NHWC. More...
 
int32_t channels_index () const
 Index of the channels dimension specified by layout. E.g. returns 3 for TENSOR_LAYOUT_NHWC. More...
 
eTensorLayout elayout () const
 Returns the layout enum stored in the TensorLayout object. More...
 
int32_t height_index () const
 Index of the height dimension specified by layout. E.g. returns 1 for TENSOR_LAYOUT_NHWC. More...
 
int32_t max_features_index () const
 Index of the max features dimension specified by layout. More...
 
bool operator!= (const eTensorLayout &rhs) const
 
bool operator!= (const TensorLayout &rhs) const
 
bool operator== (const eTensorLayout &rhs) const
 
bool operator== (const TensorLayout &rhs) const
 
int32_t rank () const
 Returns the rank of the Tensor Layout object. More...
 
int32_t sift_features_index () const
 Index of the sift features dimension specified by layout. More...
 
int32_t sift_octave_layer_index () const
 Index of the sift octave layer dimension specified by layout. More...
 
 TensorLayout (eTensorLayout layout)
 Construct a new Tensor Layout object. More...
 
int32_t width_index () const
 Index of the width dimension specified by layout. E.g. returns 2 for TENSOR_LAYOUT_NHWC. More...
 

Static Public Attributes

static const std::unordered_map< eTensorLayout, TensorLayoutDesclayoutDescriptorTable
 Provides descriptors for each feature of a specified layout type. More...
 

Detailed Description

TensorLayout class.

Constructor & Destructor Documentation

◆ TensorLayout()

roccv::TensorLayout::TensorLayout ( eTensorLayout  layout)
inlineexplicit

Construct a new Tensor Layout object.

Parameters
[in]layoutThe desired layout of the TensorLayout object. See eTensorLayout for information on supported layouts.

Member Function Documentation

◆ batch_index()

int32_t roccv::TensorLayout::batch_index ( ) const
inline

Index of the batch dimension specified by layout. E.g. returns 0 for TENSOR_LAYOUT_NHWC.

Returns
Index or -1 if the layout does not have a batch dimension.

◆ channels_index()

int32_t roccv::TensorLayout::channels_index ( ) const
inline

Index of the channels dimension specified by layout. E.g. returns 3 for TENSOR_LAYOUT_NHWC.

Returns
Index of the channels dimension.

◆ elayout()

eTensorLayout roccv::TensorLayout::elayout ( ) const
inline

Returns the layout enum stored in the TensorLayout object.

Returns
eTensorLayout

◆ height_index()

int32_t roccv::TensorLayout::height_index ( ) const
inline

Index of the height dimension specified by layout. E.g. returns 1 for TENSOR_LAYOUT_NHWC.

Returns
Index of the height dimension.

◆ max_features_index()

int32_t roccv::TensorLayout::max_features_index ( ) const
inline

Index of the max features dimension specified by layout.

Returns
Index of the max features dimension or -1 if the layout does not contain it.

◆ operator!=() [1/2]

bool roccv::TensorLayout::operator!= ( const eTensorLayout rhs) const
inline

◆ operator!=() [2/2]

bool roccv::TensorLayout::operator!= ( const TensorLayout rhs) const
inline

◆ operator==() [1/2]

bool roccv::TensorLayout::operator== ( const eTensorLayout rhs) const
inline

◆ operator==() [2/2]

bool roccv::TensorLayout::operator== ( const TensorLayout rhs) const
inline

◆ rank()

int32_t roccv::TensorLayout::rank ( ) const
inline

Returns the rank of the Tensor Layout object.

Returns
int32_t

◆ sift_features_index()

int32_t roccv::TensorLayout::sift_features_index ( ) const
inline

Index of the sift features dimension specified by layout.

Returns
int32_t

◆ sift_octave_layer_index()

int32_t roccv::TensorLayout::sift_octave_layer_index ( ) const
inline

Index of the sift octave layer dimension specified by layout.

Returns
int32_t

◆ width_index()

int32_t roccv::TensorLayout::width_index ( ) const
inline

Index of the width dimension specified by layout. E.g. returns 2 for TENSOR_LAYOUT_NHWC.

Returns
Index of the width dimension.

Member Data Documentation

◆ layoutDescriptorTable

const std::unordered_map<eTensorLayout, TensorLayoutDesc> roccv::TensorLayout::layoutDescriptorTable
inlinestatic
Initial value:
= {
{TENSOR_LAYOUT_HWC, {3, -1, 1, 0, 2, -1, -1, -1}}, {TENSOR_LAYOUT_NC, {2, 0, -1, -1, 1, -1, -1, -1}},
{TENSOR_LAYOUT_NW, {2, 0, 1, -1, -1, -1, -1, -1}}, {TENSOR_LAYOUT_NHWC, {4, 0, 2, 1, 3, -1, -1, -1}},
{TENSOR_LAYOUT_NMC, {3, 0, -1, -1, -1, 1, 2, -1}}, {TENSOR_LAYOUT_NMD, {3, 0, -1, -1, -1, 1, 2, -1}},
{TENSOR_LAYOUT_LNHWC, {5, 1, 3, 2, 4, -1, -1, 0}}, {TENSOR_LAYOUT_NCHW, {4, 0, 3, 2, 1, -1, -1, -1}},
{TENSOR_LAYOUT_N, {1, 0, -1, -1, -1, -1, -1, -1}}, {TENSOR_LAYOUT_NWC, {3, 0, 1, -1, 2, -1, -1, -1}}}
@ TENSOR_LAYOUT_NW
Definition: util_enums.h:42
@ TENSOR_LAYOUT_N
Definition: util_enums.h:43
@ TENSOR_LAYOUT_NWC
Definition: util_enums.h:51
@ TENSOR_LAYOUT_NMC
Definition: util_enums.h:44
@ TENSOR_LAYOUT_HWC
Definition: util_enums.h:40
@ TENSOR_LAYOUT_NC
Definition: util_enums.h:41
@ TENSOR_LAYOUT_LNHWC
Definition: util_enums.h:48
@ TENSOR_LAYOUT_NCHW
Definition: util_enums.h:50
@ TENSOR_LAYOUT_NMD
Definition: util_enums.h:46
@ TENSOR_LAYOUT_NHWC
Definition: util_enums.h:39

Provides descriptors for each feature of a specified layout type.


The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor_layout.hpp