create_reduction#

nvmath.bindings.cutensor.create_reduction(
intptr_t handle,
intptr_t desc_a,
mode_a,
int op_a,
intptr_t desc_c,
mode_c,
int op_c,
intptr_t desc_d,
mode_d,
int op_reduce,
intptr_t desc_compute,
) intptr_t[source]#

Creates a cutensorOperatorDescriptor_t object that encodes a tensor reduction 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. mode_a[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorCreateTensorDescriptor. Modes that only appear in mode_a but not in mode_c are reduced (contracted). 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_c (intptr_t) – The descriptor that holds the information about the data type, modes and strides of C.

  • mode_c (object) –

    Array with ‘nmode_c’ entries that represent the modes of C. mode_c[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorCreateTensorDescriptor. 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) – Must be identical to desc_c for now.

  • mode_d (object) –

    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.

  • op_reduce (Operator) – binary operator used to reduce elements of A.

  • desc_compute (intptr_t) – All arithmetic is performed using this data type (i.e., it affects the accuracy and performance).

Returns:

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

Return type:

intptr_t

See also

cutensorCreateReduction