pub unsafe extern "C" fn cutensorCreatePermutation(
handle: cutensorHandle_t,
desc: *mut cutensorOperationDescriptor_t,
descA: cutensorTensorDescriptor_t,
modeA: *const i32,
opA: cutensorOperator_t,
descB: cutensorTensorDescriptor_t,
modeB: *const i32,
descCompute: cutensorComputeDescriptor_t,
) -> cutensorStatus_tExpand description
This function creates an operation descriptor for a tensor permutation.
The tensor permutation has the following general form:
$$ B_{\Pi^B(i_0,i_1,…,i_n)} = \alpha op_A(A_{\Pi^A(i_0,i_1,…,i_n)}) $$ Consequently, this function performs an out-of-place tensor permutation and is a specialization of cutensorCreateElementwiseBinary.
Where
- A and B are multi-mode tensors (of arbitrary data types),
- $\Pi^A, \Pi^B$ are permutation operators that permute the modes of A, B respectively,
- $op_A$ is an unary element-wise operators (e.g., IDENTITY, SQR, CONJUGATE), and
Broadcasting (of a mode) can be achieved by simply omitting that mode from the respective tensor.
Modes may appear in any order. The only restrictions are:
- modes that appear in A must also appear in the output tensor.
- each mode may appear in each tensor at most once.
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 permutation.descA: The descriptor that holds information about the data type, modes, and strides of A.modeA: Array of size descA->numModes that holds the names of the modes of A (e.g., if A_{a,b,c} => modeA = {‘a’,’b’,’c’}).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.descB: The descriptor that holds information about the data type, modes, and strides of B.modeB: Array of size descB->numModes that holds the names of the modes of B.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.