Template Class FullTensorWrap< const T, N >

Class Documentation

template<typename T, int N>
class FullTensorWrap<const T, N>

Public Types

using ValueType = const T

Public Functions

FullTensorWrap() = default
template<typename DataType> inline explicit __host__ __device__ FullTensorWrap (const DataType *data, const int(&strides)[N], const int(&shapes)[N])

Constructs a constant FullTensorWrap by wrapping a const data pointer argument.

Parameters:
  • data[in] Pointer to the data that will be wrapped.

  • strides[in] Array of strides in bytes from first to last dimension.

  • shapes[in] Array of shapes (number of elements) from first to last dimension.

Template Parameters:

DataType – Type of (inferred from) the data pointer argument.

inline __host__ FullTensorWrap(const TensorDataStridedCuda &tensor)

Constructs a constant FullTensorWrap by wrapping a tensor argument.

Parameters:

tensor[in] Tensor reference to the tensor that will be wrapped.

inline __host__ __device__ const int * strides () const

Get strides in bytes for read-only access.

Returns:

The const array (as a pointer) containing the strides in bytes.

inline __host__ __device__ const int * shapes () const

Get shapes for read-only access.

Returns:

The const array (as a pointer) containing the shapes.

template<typename DimType> inline const __host__ __device__ T & operator[] (DimType c) const

Subscript operator for read-only access.

Parameters:

c[in] N-D coordinate (from last to first dimension) to be accessed.

Returns:

Accessed const reference.

template<typename... Args> inline const __host__ __device__ T * ptr (Args... c) const

Get a read-only proxy (as pointer) at the Dth dimension.

Parameters:

c0..D[in] Each coordinate from first to last dimension.

Returns:

The const pointer to the beginning of the Dth dimension.

Public Static Attributes

static constexpr int kNumDimensions = N
static constexpr int kVariableStrides = N
static constexpr int kConstantStrides = 0

Protected Functions

template<typename... Args> inline const __host__ __device__ T * doGetPtr (Args... c) const