The Tensor class abstracts the tensor data access
Definition at line 49 of file service-maker/includes/tensor.hpp.
Data Structures | |
class | Context |
Context object of the tensor, which associates the tensor with what creates it. More... | |
Public Types | |
enum | DataType { INVALID = -1, UNSIGNED, SIGNED, FLOAT, COMPLEX } |
Code for tensor data types. More... | |
enum | DeviceType { NONE = -1, CPU, GPU } |
Public Member Functions | |
Tensor (unsigned int rank, DataType dtype, unsigned int bits, const int64_t shape[], const int64_t strides[], void *data, std::string format, unsigned int device_id, DeviceType device, Context *context) | |
Construct from common tensor configurations. More... | |
Tensor (const Tensor &)=delete | |
Copy of a tensor is not allowed, use clone instead. More... | |
virtual | ~Tensor () |
Destructor. More... | |
unsigned int | rank () const |
Number of dimenstions of the tensor. More... | |
TensorShape | shape () const |
Shape of the tensor in vector. More... | |
DataType | dtype () const |
Data type of the tensor elements. More... | |
unsigned int | bits () const |
Number of bits for each data. More... | |
uint64_t | stride (unsigned int d) const |
Retrieve the stride of a specific dimension. More... | |
void * | data () const |
Retrieve the allocated data pointer. More... | |
unsigned int | deviceId () const |
Retrieve the device id. More... | |
DeviceType | deviceType () const |
Retrieve the device type. More... | |
Buffer | wrap (NvBufSurfaceColorFormat format) |
Wrap the tensor to a buffer. More... | |
Tensor * | clone () const |
Clone a tensor. More... | |
Tensor * | toGPU (unsigned int device_id) const |
Copy the tensor to GPU. More... | |
uint64_t | size () const |
total size of the tensor in bytes More... | |
Protected Attributes | |
TensorImplementation * | impl_ |
std::string | format_ |
std::unique_ptr< Context > | context_ |
Code for tensor data types.
Enumerator | |
---|---|
INVALID | |
UNSIGNED | |
SIGNED | |
FLOAT | |
COMPLEX |
Definition at line 54 of file service-maker/includes/tensor.hpp.
Enumerator | |
---|---|
NONE | |
CPU | |
GPU |
Definition at line 62 of file service-maker/includes/tensor.hpp.
deepstream::Tensor::Tensor | ( | unsigned int | rank, |
DataType | dtype, | ||
unsigned int | bits, | ||
const int64_t | shape[], | ||
const int64_t | strides[], | ||
void * | data, | ||
std::string | format, | ||
unsigned int | device_id, | ||
DeviceType | device, | ||
Context * | context | ||
) |
Construct from common tensor configurations.
|
delete |
Copy of a tensor is not allowed, use clone instead.
|
virtual |
Destructor.
unsigned int deepstream::Tensor::bits | ( | ) | const |
Number of bits for each data.
Tensor* deepstream::Tensor::clone | ( | ) | const |
Clone a tensor.
void* deepstream::Tensor::data | ( | ) | const |
Retrieve the allocated data pointer.
unsigned int deepstream::Tensor::deviceId | ( | ) | const |
Retrieve the device id.
DeviceType deepstream::Tensor::deviceType | ( | ) | const |
Retrieve the device type.
DataType deepstream::Tensor::dtype | ( | ) | const |
Data type of the tensor elements.
unsigned int deepstream::Tensor::rank | ( | ) | const |
Number of dimenstions of the tensor.
TensorShape deepstream::Tensor::shape | ( | ) | const |
Shape of the tensor in vector.
uint64_t deepstream::Tensor::size | ( | ) | const |
total size of the tensor in bytes
uint64_t deepstream::Tensor::stride | ( | unsigned int | d | ) | const |
Retrieve the stride of a specific dimension.
Tensor* deepstream::Tensor::toGPU | ( | unsigned int | device_id | ) | const |
Copy the tensor to GPU.
Buffer deepstream::Tensor::wrap | ( | NvBufSurfaceColorFormat | format | ) |
Wrap the tensor to a buffer.
|
protected |
Definition at line 164 of file service-maker/includes/tensor.hpp.
|
protected |
Definition at line 163 of file service-maker/includes/tensor.hpp.
|
protected |
Definition at line 162 of file service-maker/includes/tensor.hpp.