create_block_sparse_tensor_descriptor#

nvmath.bindings.cutensor.create_block_sparse_tensor_descriptor(
intptr_t handle,
uint32_t num_modes,
uint64_t num_non_zero_blocks,
num_sections_per_mode,
extent,
non_zero_coordinates,
stride,
int data_type,
) intptr_t[source]#

Create a block-sparse tensor descriptor.

Parameters:
  • handle (intptr_t) – The library handle.

  • num_modes (uint32_t) – The number of modes. Currently, a maximum of 8 modes is supported.

  • num_non_zero_blocks (uint64_t) – The number of non-zero blocks in the block-sparse tensor.

  • num_sections_per_mode (object) –

    The number of sections of each mode (host array of size num_modes). It can be:

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

    • a Python sequence of uint32_t.

  • extent (object) –

    The extents of the sections of each mode (host array of size \sum_i^num_modes(num_sections_per_mode[i])). First come the extents of the sections of the first mode, then the extents of the sections of the second mode, and so forth. It can be:

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

    • a Python sequence of int64_t.

  • non_zero_coordinates (object) –

    Block-coordinates of each non-zero block (host array of size num_modes x num_non_zero_blocks). Blocks can be specified in any order, however, that order must be consistent with stride and alignmentRequirement arrays. It can be:

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

    • a Python sequence of int32_t.

  • stride (object) –

    The strides of each dense block (either nullptr or a host array of size num_modes x num_non_zero_blocks). First the strides of the first block, then the strides of the second block, with the blocks in the same order as in non_zero_coordinates. Passing nullptr means contiguous column-major order for each block. Moreover, the strides need to be compatible in the following sense: Suppose you sort the strides of the first block, such that they are ascending; this sorting results in a permutation. If you apply this permutation to the strides of any other block, the result needs to be sorted as well. As an example:. 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. We assume the same datatype for each block. Currently, the only supported values are CUDA_C_64F, CUDA_C_32F, CUDA_R_64F, and CUDA_R_32F.

Returns:

The resulting block-sparse tensor descriptor.

Return type:

intptr_t

See also

cutensorCreateBlockSparseTensorDescriptor