create_contraction#

nvmath.bindings.cutensor.create_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 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 and strides of A.

  • mode_a (object) –

    Array with ‘nmode_a’ entries that represent the modes of A. The mode_a[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor. 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.

  • desc_b (intptr_t) – The descriptor that holds information about the data type, modes, and strides of B.

  • mode_b (object) –

    Array with ‘nmode_b’ entries that represent the modes of B. The mode_b[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor. 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.

  • desc_c (intptr_t) – Array with ‘nmode_c’ entries that represent the modes of C. The mode_c[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor.

  • mode_c (object) –

    The escriptor that holds information about the data type, modes, and strides of C. 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.

  • desc_d (intptr_t) – Array with ‘nmode_d’ entries that represent the modes of D (must be identical to mode_c for now). The mode_d[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor.

  • mode_d (object) –

    The descriptor that holds information about the data type, modes, and strides of D (must be identical to desc_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) – Determines the precision in which this operations is performed.

Returns:

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

Return type:

intptr_t

See also

cutensorCreateContraction