pub unsafe extern "C" fn cutensorCreateElementwiseBinary(
handle: cutensorHandle_t,
desc: *mut cutensorOperationDescriptor_t,
descA: cutensorTensorDescriptor_t,
modeA: *const i32,
opA: cutensorOperator_t,
descC: cutensorTensorDescriptor_t,
modeC: *const i32,
opC: cutensorOperator_t,
descD: cutensorTensorDescriptor_t,
modeD: *const i32,
opAC: cutensorOperator_t,
descCompute: cutensorComputeDescriptor_t,
) -> cutensorStatus_tExpand description
This function creates an operation descriptor for an elementwise binary operation.
The binary operation has the following general form: $$ D_{\Pi^C(i_0,i_1,…,i_n)} = \Phi_{AC}(\alpha op_A(A_{\Pi^A(i_0,i_1,…,i_n)}), \gamma op_C(C_{\Pi^C(i_0,i_1,…,i_n)})) $$
Call cutensorElementwiseBinaryExecute to perform the actual operation.
Supported data-type combinations are:
Remark
calls asynchronous functions, no reentrant, and thread-safe.
§Parameters
handle: Opaque handle holding cuTENSOR’s library context.desc: This opaque struct gets allocated and filled with the information that encodes the requested elementwise operation.descA: The descriptor that holds the information about the data type, modes, and strides of A.modeA: Array (in host memory) of size descA->numModes that holds the names of the modes of A (e.g., if A_{a,b,c} => modeA = {‘a’,’b’,’c’}). The modeA[i] corresponds to extent[i] and stride[i] with respect to the arguments provided tocutensorCreateTensorDescriptor.opA: Unary operator that will be applied to each element of A before it is further processed. The original data of this tensor remains unchanged.descC: The descriptor that holds information about the data type, modes, and strides of C.modeC: Array (in host memory) of size descC->numModes that holds the names of the modes of C. The modeC[i] corresponds to extent[i] and stride[i] of thecutensorCreateTensorDescriptor.opC: Unary operator that will be applied to each element of C before it is further processed. The original data of this tensor remains unchanged.descD: The descriptor that holds information about the data type, modes, and strides of D. Notice that we currently request descD and descC to be identical.modeD: Array (in host memory) of size descD->numModes that holds the names of the modes of D. The modeD[i] corresponds to extent[i] and stride[i] of thecutensorCreateTensorDescriptor.opAC: Element-wise binary operator (corresponding to $\Phi_{AC}$ above).descCompute: Determines the precision in which this operations is performed.
§Return value
cutensorStatus_t::CUTENSOR_STATUS_INVALID_VALUE: if tensor dimensions or modes have an illegal value.cutensorStatus_t::CUTENSOR_STATUS_NOT_INITIALIZED: if the handle is not initialized.cutensorStatus_t::CUTENSOR_STATUS_NOT_SUPPORTED: if the combination of data types or operations is not supported.cutensorStatus_t::CUTENSOR_STATUS_SUCCESS: The operation completed successfully without error.