Template Class TensorShapeInfoImpl

Class Documentation

template<typename LAYOUT_INFO>
class TensorShapeInfoImpl

This class provides detailed information about the shape of a tensor.

The class is templated on the layout information type, which allows it to be adapted to various tensor layout schemes. It provides functions to retrieve the shape, layout, and additional metadata about the tensor.

Template Parameters:

LAYOUT_INFO – The type that contains layout information for the tensor.

Public Types

using LayoutInfo = LAYOUT_INFO

Type alias for the layout information of the tensor.

Public Functions

inline TensorShapeInfoImpl(const TensorShape &shape, const LayoutInfo &infoLayout)

A constructor that initializes a TensorShapeInfoImpl with the provided shape and layout information.

Parameters:
  • shape – The shape of the tensor.

  • infoLayout – The layout information of the tensor.

inline const TensorShape &shape() const

Returns the shape of the tensor.

Returns:

The shape of the tensor.

inline const TensorLayout &layout() const

Returns the layout of the tensor, this is a subset of LayoutInfo and is a convenience function.

Returns:

The layout of the tensor.

inline const LayoutInfo &infoLayout() const

Returns the layout and additional information of the tensor.

See also

TensorLayoutInfo.

Returns:

The layout information of the tensor.

inline TensorShape::DimType numSamples() const

Returns the number of samples in the tensor. If the tensor is not batched, the number of samples is 1. (i.e Nhwc)

Returns:

The number of samples in the tensor.

inline bool isImage() const

Checks if the tensor is an image.

Returns:

True if the tensor is an image, false otherwise.

Protected Attributes

TensorShape m_shape
LayoutInfo m_infoLayout
int m_cacheNumSamples