create_tensor_descriptor#

nvmath.bindings.cutensor.create_tensor_descriptor(
intptr_t handle,
uint32_t num_modes,
extent,
stride,
int data_type,
uint32_t alignment_requirement,
) intptr_t[source]#

Creates a tensor descriptor.

Parameters:
  • handle (intptr_t) – Opaque handle holding cuTENSOR’s library context.

  • num_modes (uint32_t) – Number of modes.

  • extent (object) –

    Extent of each mode (must be larger than zero). It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int64_t.

  • stride (object) –

    stride[i] denotes the displacement (a.k.a. stride)–in elements of the base type–between two consecutive elements in the ith-mode. If stride is NULL, a packed generalized column-major memory layout is assumed (i.e., the strides increase monotonically from left to right). Each stride must be larger than zero; to be precise, a stride of zero can be achieved by omitting this mode entirely; for instance instead of writing C[a,b] = A[b,a] with strideA(a) = 0, you can write C[a,b] = A[b] directly; cuTENSOR will then automatically infer that the a-mode in A should be broadcasted. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int64_t.

  • data_type (int) – Data type of the stored entries.

  • alignment_requirement (uint32_t) – Alignment (in bytes) to the base pointer that will be used in conjunction with this tensor descriptor (e.g., cudaMalloc has a default alignment of 256 bytes).

Returns:

Pointer to the address where the allocated tensor descriptor object will be stored.

Return type:

intptr_t

See also

cutensorCreateTensorDescriptor