Class TensorLayoutInfo

Inheritance Relationships

Derived Type

Class Documentation

class TensorLayoutInfo

Provides information and utility functions related to tensor layouts.

The TensorLayoutInfo class provides a series of utility functions to inspect and work with tensor layouts. It allows checking the compatibility of a given layout, creating instances from a layout, and querying specific properties of the layout, such as whether it represents a batch or an image.

Subclassed by nvcv::TensorLayoutInfoImage

Public Functions

inline constexpr const TensorLayout &layout() const

Get the layout of the tensor.

Returns:

The tensor’s layout.

inline constexpr bool isBatch() const

Check if the layout includes a batch dimension.

Returns:

true if the layout includes a batch dimension, false otherwise.

inline int idxSample() const

Get the index of the sample dimension in the layout.

Returns:

The index of the sample dimension, or -1 if there is no sample dimension.

inline bool isImage() const

Check if the layout corresponds to an image.

Returns:

true if the layout corresponds to an image, false otherwise.

Public Static Functions

static inline bool IsCompatible(const TensorLayout&)

Check if the given layout is compatible.

For this base class, all layouts are considered compatible.

Parameters:

layout – The layout to check for compatibility.

Returns:

true since all layouts are compatible.

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

Create a TensorLayoutInfo object from the given layout.

Parameters:

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

Returns:

A TensorLayoutInfo object constructed with the given layout.

Protected Functions

inline TensorLayoutInfo(const TensorLayout &layout)