/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor_data.hpp Source File#
4 min read time
Applies to Linux
tensor_data.hpp
Go to the documentation of this file.
93 static_assert(std::is_base_of<TensorData, Derived>::value, "Cannot cast TensorData to an unrelated type.");
94 static_assert(sizeof(Derived) == sizeof(TensorData), "Derived type must not add any additional data members.");
126 TensorDataStrided(const TensorShape &tshape, const DataType &dtype, const TensorBufferStrided &buffer,
Holds the underlying tensor data alongside metadata (shape, layout, datatype). Non-strided tensor dat...
Definition: tensor_data.hpp:42
virtual int rank() const
Returns the rank (the number of dimensions) of the tensor data.
TensorData()=delete
virtual void * basePtr() const
Returns the base pointer of the tensor data in memory.
TensorData(const TensorShape &tshape, const DataType &dtype, const TensorBufferStrided &buffer, const eDeviceType device=eDeviceType::GPU)
virtual const eDeviceType device() const
Retrieves the location where the tensor data is allocated, either on the device or the host.
virtual const DataType & dtype() const
Retrieves the data type of the tensor's elements.
virtual ~TensorData()=default
Holds the underlying tensor data alongside tensor metadata. This particular tensor data type is used ...
Definition: tensor_data.hpp:114
const int64_t stride(int d) const
Returns the stride at a given dimension.
TensorDataStrided(const TensorShape &tshape, const DataType &dtype, const TensorBufferStrided &buffer, const eDeviceType device=eDeviceType::GPU)
Constructs a TensorDataStrided object.
Definition: strided_data_wrap.hpp:33
eDeviceType
Describes the device type. Used to determine where Tensor data should be allocated and whether operat...
Definition: util_enums.h:69
@ GPU