TensorStorage Class Reference

TensorStorage Class Reference#

2 min read time

Applies to Linux

rocCV: roccv::TensorStorage Class Reference
roccv::TensorStorage Class Reference

Stores the underlying data of a tensor and is responsible for allocation/freeing of tensor memory. Agnostic to the tensor's metadata (shape, datatype, etc.) More...

#include <tensor_storage.hpp>

Public Member Functions

void * data () const
 Retrieves a raw pointer to the underlying tensor data. More...
 
const eDeviceType device () const
 Retrieves the device that the tensor data is allocated on. More...
 
 TensorStorage (size_t bytes, eDeviceType device)
 Creates a new TensorStorage object and allocates the requested number of bytes. More...
 
 TensorStorage (void *data, eDeviceType device, eOwnership ownership=eOwnership::OWNING)
 Creates a new TensorStorage object and takes ownership of the data pointer. More...
 
 ~TensorStorage ()
 

Detailed Description

Stores the underlying data of a tensor and is responsible for allocation/freeing of tensor memory. Agnostic to the tensor's metadata (shape, datatype, etc.)

Constructor & Destructor Documentation

◆ TensorStorage() [1/2]

roccv::TensorStorage::TensorStorage ( void *  data,
eDeviceType  device,
eOwnership  ownership = eOwnership::OWNING 
)
explicit

Creates a new TensorStorage object and takes ownership of the data pointer.

Parameters
dataA pointer to allocated memory.
deviceThe device which the allocated memory is on.
ownershipWhether this object should own <data> (responsible for freeing it once it goes out of scope). Default is eOwnership::OWNING.

◆ TensorStorage() [2/2]

roccv::TensorStorage::TensorStorage ( size_t  bytes,
eDeviceType  device 
)
explicit

Creates a new TensorStorage object and allocates the requested number of bytes.

Parameters
bytesNumber of bytes to allocate.
deviceThe device to allocate the memory on.

◆ ~TensorStorage()

roccv::TensorStorage::~TensorStorage ( )

Member Function Documentation

◆ data()

void* roccv::TensorStorage::data ( ) const

Retrieves a raw pointer to the underlying tensor data.

Returns
void*

◆ device()

const eDeviceType roccv::TensorStorage::device ( ) const

Retrieves the device that the tensor data is allocated on.

Returns
const eDeviceType

The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor_storage.hpp