/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor.hpp Source File#
5 min read time
Applies to Linux
tensor.hpp
Go to the documentation of this file.
66 explicit Tensor(const TensorShape &shape, DataType dtype, const eDeviceType device = eDeviceType::GPU);
77 explicit Tensor(int num_images, Size2D image_size, ImageFormat fmt, eDeviceType device = eDeviceType::GPU);
Acts as a container for data corresponding to how image data is laid out in memory.
Definition: image_format.hpp:41
Holds the underlying tensor data alongside metadata (shape, layout, datatype). Non-strided tensor dat...
Definition: tensor_data.hpp:42
Definition: tensor.hpp:37
Tensor(const Tensor &other)=delete
static Requirements CalcRequirements(const TensorShape &shape, DataType dtype, const eDeviceType device=eDeviceType::GPU)
Calculates tensor requirements. This essentially wraps the provided parameters into a TensorRequireme...
Tensor(const TensorShape &shape, DataType dtype, const eDeviceType device=eDeviceType::GPU)
Constructs a tensor object and allocates the appropriate amount of memory on the specified device.
const eDeviceType device() const
Returns the location (device or host) of the tensor data.
const int64_t shape(int d) const &
Retrieves a specific dimension size from the tensor shape.
Tensor(Tensor &&other)
Tensor & operator=(const Tensor &other)
DerivedTensorData exportData() const
Exports tensor data and casts it to a specified tensor data object.
Definition: tensor.hpp:139
Tensor(const TensorRequirements &reqs)
Constructs a Tensor object given a list of requirements. Creating a tensor through this constructor w...
Tensor reshape(const TensorShape &new_shape) const
Creates a view of this tensor with a new shape and layout.
Tensor reshape(const TensorShape &new_shape, const DataType &new_dtype) const
Creates a vew of this tensor with a new shape, layout, and data type. The number of bytes allocated m...
static Requirements CalcRequirements(int num_images, Size2D image_size, ImageFormat fmt, eDeviceType device=eDeviceType::GPU)
Calculates tensor requirements using image-based parameters.
Tensor(int num_images, Size2D image_size, ImageFormat fmt, eDeviceType device=eDeviceType::GPU)
Constructs a tensor using image-based requirements and allocates the appropriate amount of memory on ...
Tensor(const TensorRequirements &reqs, std::shared_ptr< TensorStorage > data)
Constructs a Tensor object given a list of requirements and the underlying data as a TensorStorage po...
Definition: strided_data_wrap.hpp:33
Tensor TensorWrapData(const TensorData &tensor_data)
Wraps TensorData object into a Tensor object.
Definition: tensor_requirements.hpp:29
eDeviceType
Describes the device type. Used to determine where Tensor data should be allocated and whether operat...
Definition: util_enums.h:69
@ GPU