Class TensorData
Defined in File TensorData.hpp
Inheritance Relationships
Derived Type
public nvcv::TensorDataStrided
(Class TensorDataStrided)
Class Documentation
-
class TensorData
Represents data for a tensor in the system.
The TensorData class provides an interface to access and manage the underlying data of a tensor. It offers functionalities to retrieve tensor shape, layout, data type, and other properties. The tensor’s data is encapsulated in an
NVCVTensorData
object.Subclassed by nvcv::TensorDataStrided
Public Functions
-
inline TensorData(const NVCVTensorData &data)
Constructs a TensorData object from an
NVCVTensorData
instance.- Parameters:
data – The underlying tensor data representation.
-
inline int rank() const
Retrieves the rank (number of dimensions) of the tensor.
-
inline const TensorShape &shape() const &
Retrieves the shape of the tensor.
-
inline const TensorShape::DimType &shape(int d) const &
Retrieves a specific dimension size from the tensor shape.
- Parameters:
d – The index of the dimension.
- Returns:
The size of the specified dimension.
-
inline const TensorLayout &layout() const &
Retrieves the layout of the tensor.
-
inline TensorShape shape() &&
Retrieves the shape of the tensor (rvalue overload).
-
inline TensorShape::DimType shape(int d) &&
Retrieves a specific dimension size from the tensor shape (rvalue overload).
-
inline TensorLayout layout() &&
Retrieves the layout of the tensor (rvalue overload).
-
inline const NVCVTensorData &cdata() const &
Retrieves a constant reference to the underlying tensor data.
-
inline NVCVTensorData cdata() &&
Retrieves the underlying tensor data (rvalue overload).
-
template<typename DerivedTensorData>
Optional<DerivedTensorData> cast() const Attempts to cast the current tensor data to a derived tensor data type.
- Template Parameters:
DerivedTensorData – The derived tensor data type to cast to.
- Returns:
An optional containing the casted tensor data if successful; otherwise, an empty optional.
-
template<typename Derived>
bool IsCompatible() const Checks if the current tensor data is compatible with a derived type.
- Template Parameters:
Derived – The derived type to check compatibility against.
- Returns:
true if the current tensor data is compatible with the derived type, false otherwise.
Public Static Functions
-
static inline bool IsCompatibleKind(NVCVTensorBufferType kind)
Determines if a given tensor buffer type is compatible.
- Parameters:
kind – The tensor buffer type to check.
- Returns:
true if the buffer type is compatible, false otherwise.
-
inline TensorData(const NVCVTensorData &data)