Template Class TensorWrap< const T, Strides… >

Class Documentation

template<typename T, int... Strides>
class TensorWrap<const T, Strides...>

Public Types

using ValueType = const T

Public Functions

TensorWrap() = default
template<typename DataType, typename... Args> inline explicit __host__ __device__ TensorWrap (const DataType *data, Args... strides)

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

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

  • strides0..D[in] Each run-time pitch in bytes from first to last dimension.

template<typename DataType, typename StrideType> inline explicit __host__ __device__ TensorWrap (const DataType *data, StrideType *strides)

Constructs a constant TensorWrap by wrapping a const data pointer argument and copying the dyncamic strides from a given buffer.

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

  • strides[in] Pointer to stride data

inline __host__ TensorWrap(const ImageDataStridedCuda &image)

Constructs a constant TensorWrap by wrapping an image argument.

Parameters:

image[in] Image reference to the image that will be wrapped.

inline __host__ TensorWrap(const TensorDataStridedCuda &tensor)

Constructs a constant TensorWrap 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 run-time pitch in bytes.

Returns:

The const array (as a pointer) containing run-time pitches in bytes.

template<typename DimType, class = Require<std::is_same_v<int, BaseType<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 = sizeof...(Strides)
static constexpr int kVariableStrides = ((Strides == -1) + ...)
static constexpr int kConstantStrides = kNumDimensions - kVariableStrides

Protected Functions

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