Template Class TensorDataAccessStridedImpl
Defined in File TensorDataAccess.hpp
Inheritance Relationships
Derived Types
public nvcv::detail::TensorDataAccessStridedImageImpl< TensorShapeInfoImage >
(Template Class TensorDataAccessStridedImageImpl)public nvcv::detail::TensorDataAccessStridedImageImpl< ShapeInfo >
(Template Class TensorDataAccessStridedImageImpl)
Class Documentation
-
template<typename ShapeInfo, typename LayoutInfo = typename ShapeInfo::LayoutInfo>
class TensorDataAccessStridedImpl Provides access to strided tensor data, allowing for more efficient memory access patterns.
This class offers utilities for accessing the data in a tensor using a strided memory layout. It provides functions to retrieve the number of samples, data type, layout, and shape of the tensor. It also contains utilities for computing strides and accessing specific samples.
- Template Parameters:
ShapeInfo – The type that contains shape information for the tensor.
LayoutInfo – The type that contains layout information for the tensor. By default, it is derived from ShapeInfo.
Subclassed by nvcv::detail::TensorDataAccessStridedImageImpl< TensorShapeInfoImage >, nvcv::detail::TensorDataAccessStridedImageImpl< ShapeInfo >
Public Functions
-
inline TensorDataAccessStridedImpl(const TensorDataStrided &tdata, const ShapeInfo &infoShape)
Constructor that initializes the object with given tensor data and shape information.
- Parameters:
tdata – The strided tensor data.
infoShape – The shape information of the tensor.
-
inline TensorShape::DimType numSamples() const
Returns the number of samples in the tensor.
- Returns:
The number of samples.
-
inline DataType dtype() const
Returns the data type of the tensor.
- Returns:
The tensor’s data type.
-
inline const TensorLayout &layout() const
Returns the layout of the tensor.
- Returns:
The tensor’s layout.
-
inline const TensorShape &shape() const
Returns the shape of the tensor.
- Returns:
The tensor’s shape.
-
inline int64_t sampleStride() const
Computes the stride of the sample dimension.
- Returns:
The sample stride, or 0 if the sample dimension is not present.
-
inline Byte *sampleData(int n) const
Retrieves a pointer to the data of a specific sample.
- Parameters:
n – The index of the sample.
- Returns:
A pointer to the sample’s data.
-
inline Byte *sampleData(int n, Byte *base) const
Retrieves a pointer to the data of a specific sample, relative to a given base pointer.
- Parameters:
n – The index of the sample.
base – The base pointer from which to compute the sample’s data address.
- Returns:
A pointer to the sample’s data.
-
inline bool isImage() const
Checks if the tensor corresponds to an image.
- Returns:
True if the tensor corresponds to an image, false otherwise.
-
inline const ShapeInfo &infoShape() const
Returns the shape information of the tensor.
- Returns:
The shape information.
-
inline const LayoutInfo &infoLayout() const
Returns the layout information of the tensor.
- Returns:
The layout information.
Protected Functions
-
inline TensorDataAccessStridedImpl(const TensorDataAccessStridedImpl &that, const TensorShapeInfo &infoShape)
Protected Attributes
-
TensorDataStrided m_tdata