PandA-2024.02
Data Fields
DLTensor Struct Reference

Plain C Tensor object, does not manage memory. More...

#include <dlpack.h>

Collaboration diagram for DLTensor:
Collaboration graph
[legend]

Data Fields

void * data
 The opaque data pointer points to the allocated data. This will be CUDA device pointer or cl_mem handle in OpenCL. This pointer is always aligns to 256 bytes as in CUDA. More...
 
DLContext ctx
 The device context of the tensor. More...
 
int ndim
 Number of dimensions. More...
 
DLDataType dtype
 The data type of the pointer. More...
 
int64_t * shape
 The shape of the tensor. More...
 
int64_t * strides
 strides of the tensor, can be NULL, indicating tensor is compact. More...
 
uint64_t byte_offset
 The offset in bytes to the beginning pointer to data. More...
 

Detailed Description

Plain C Tensor object, does not manage memory.

Definition at line 111 of file dlpack.h.

Field Documentation

◆ byte_offset

uint64_t DLTensor::byte_offset

The offset in bytes to the beginning pointer to data.

Definition at line 146 of file dlpack.h.

◆ ctx

DLContext DLTensor::ctx

The device context of the tensor.

Definition at line 133 of file dlpack.h.

◆ data

void* DLTensor::data

The opaque data pointer points to the allocated data. This will be CUDA device pointer or cl_mem handle in OpenCL. This pointer is always aligns to 256 bytes as in CUDA.

For given DLTensor, the size of memory required to store the contents of data is calculated as follows:

static inline size_t GetDataSize(const DLTensor* t) {
size_t size = 1;
for (tvm_index_t i = 0; i < t->ndim; ++i) {
size *= t->shape[i];
}
size *= (t->dtype.bits * t->dtype.lanes + 7) / 8;
return size;
}

Definition at line 131 of file dlpack.h.

Referenced by fused_activations_wrapper(), fused_conv2d_wrapper(), fused_multiply_wrapper(), fused_nn_dense_add_wrapper(), fused_nn_max_pool2d_wrapper(), fused_nn_softmax_wrapper(), and mlp_wrapper().

◆ dtype

DLDataType DLTensor::dtype

The data type of the pointer.

Definition at line 137 of file dlpack.h.

◆ ndim

int DLTensor::ndim

Number of dimensions.

Definition at line 135 of file dlpack.h.

◆ shape

int64_t* DLTensor::shape

The shape of the tensor.

Definition at line 139 of file dlpack.h.

◆ strides

int64_t* DLTensor::strides

strides of the tensor, can be NULL, indicating tensor is compact.

Definition at line 144 of file dlpack.h.


The documentation for this struct was generated from the following file:

Generated on Mon Feb 12 2024 13:03:50 for PandA-2024.02 by doxygen 1.8.13