Class TensorLayoutInfoImage

Inheritance Relationships

Base Type

Class Documentation

class TensorLayoutInfoImage : public nvcv::TensorLayoutInfo

This class provides more information about tensor layout for image tensors.

The class inherits from TensorLayoutInfo and adds functions specific to image tensors. It provides detailed information about the tensor layout such as the number of spatial dimensions, the index of various dimensions (channel, width, height, depth), and whether the layout is row-major. It also provides functions to check whether the channel is in the first or last position.

Public Functions

inline int numSpatialDims() const

Retrieves the number of spatial dimensions in the tensor layout.

Returns:

Number of spatial dimensions.

inline bool isRowMajor() const

Checks if the tensor layout is row-major.

Returns:

true if row-major, false otherwise.

inline int idxChannel() const

Retrieves the index of the channel in the tensor layout.

Returns:

Index of the channel or -1 if not found.

inline int idxWidth() const

Retrieves the width index in the tensor layout.

Returns:

Width index or -1 if not found.

inline int idxHeight() const

Retrieves the height index in the tensor layout.

Returns:

Height index or -1 if not found.

inline int idxDepth() const

Retrieves the depth index in the tensor layout.

Returns:

Depth index or -1 if not found.

inline bool hasChannel() const

Checks if the tensor layout contains a channel.

Returns:

true if there’s a channel, false otherwise.

inline bool isChannelFirst() const

Checks if the channel appears first in the tensor layout (i.e CHW).

Returns:

true if channel is first, false otherwise.

inline bool isChannelLast() const

Checks if the channel appears last in the tensor layout (i.e. HWC).

Returns:

true if channel is last, false otherwise.

Public Static Functions

static inline bool IsCompatible(const TensorLayout &layout)

Check if the given layout is compatible with the image tensor.

Parameters:

layout – The layout to check for compatibility.

Returns:

true if the layout is compatible with an image tensor, false otherwise.

static inline Optional<TensorLayoutInfoImage> Create(const TensorLayout &layout)

Create a TensorLayoutInfoImage object if the provided layout is compatible.

Parameters:

layout – The layout to use for creating the TensorLayoutInfoImage object.

Returns:

An optional TensorLayoutInfoImage object. The object is valid if the layout is compatible.

Protected Functions

inline TensorLayoutInfoImage(const TensorLayout &layout)