create_block_sparse_contraction#

nvmath.bindings.cutensor.create_block_sparse_contraction(
intptr_t handle,
intptr_t desc_a,
mode_a,
int op_a,
intptr_t desc_b,
mode_b,
int op_b,
intptr_t desc_c,
mode_c,
int op_c,
intptr_t desc_d,
mode_d,
intptr_t desc_compute,
) intptr_t[source]#

This function allocates a cutensorOperationDescriptor_t object that encodes a block-sparse tensor contraction of the form .

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

  • desc_a (intptr_t) – The descriptor that holds the information about the data type, modes, sections, section extents, strides, and non-zero blocks of A.

  • mode_a (object) –

    Array with ‘nmode_a’ entries that represent the modes of A. Sections, i.e., block-sizes, must match among the involved block-sparse tensors. It can be:

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

    • a Python sequence of int32_t.

  • op_a (Operator) – Unary operator that will be applied to each element of A before it is further processed. The original data of this tensor remains unchanged. Currently, only CUTENSOR_OP_IDENTITY is supported.

  • desc_b (intptr_t) – The descriptor that holds information about the the data type, modes, sections, section extents, strides, and non-zero blocks of B.

  • mode_b (object) –

    Array with ‘nmode_b’ entries that represent the modes of B. Sections, i.e., block-sizes, must match among the involved block-sparse tensors. It can be:

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

    • a Python sequence of int32_t.

  • op_b (Operator) – Unary operator that will be applied to each element of B before it is further processed. The original data of this tensor remains unchanged. Currently, only CUTENSOR_OP_IDENTITY is supported.

  • desc_c (intptr_t) – Array with ‘nmode_c’ entries that represent the modes of C. Sections, i.e., block-sizes, must match among the involved block-sparse tensors.

  • mode_c (object) –

    The descriptor that holds information about the data type, modes, sections, section extents, strides, and non-zero blocks of C. Note that the block-sparsity pattern of C (the nonZeroCoordinates[] array used to create the decriptor) of C must be identical to that of D; and it is this block-sparsity pattern that determines which parts of the results are computed; no fill-in is allocated or computed. It can be:

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

    • a Python sequence of int32_t.

  • op_c (Operator) – Unary operator that will be applied to each element of C before it is further processed. The original data of this tensor remains unchanged. Currently, only CUTENSOR_OP_IDENTITY is supported.

  • desc_d (intptr_t) – For now, this must be the same opaque pointer as desc_c, and the layouts of C and D must be identical.

  • mode_d (object) –

    Array with ‘nmode_d’ entries that represent the modes of D (must be identical to mode_c for now). It can be:

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

    • a Python sequence of int32_t.

  • desc_compute (intptr_t) – Datatype of for the intermediate computation of typeCompute T = A * B.

Returns:

This opaque struct gets allocated and filled with the information that encodes the tensor contraction operation.

Return type:

intptr_t

See also

cutensorCreateBlockSparseContraction