Swap
Applicable Products
Hardware Model |
Supported or Not |
|---|---|
Not supported |
|
Not supported |
|
Not supported |
|
Supported |
|
Supported |
Function Description
API function
- asdBlasMakeSwapPlan: initializes the Swap operator configuration corresponding to the handle.
- asdBlasSswap: swaps two real-number vectors.
- asdBlasCswap: swaps two complex-number vectors.
Formula:
- asdBlasSswap formula:
Function Prototype
- AspbStatus asdBlasMakeSwapPlan(asdBlasHandle handle)
- AspbStatus asdBlasSswap(asdBlasHandle handle, const int64_t n, aclTensor *x, const int64_t incx, aclTensor *y, const int64_t incy)
- AspbStatus asdBlasCswap(asdBlasHandle handle, const int64_t n, aclTensor *x, const int64_t incx, aclTensor *y,const int64_t incy)
Parameter Description
- asdBlasMakeSwapPlan
Parameter
Input/Output
Type
Description
handle
Input
asdBlasHandle
Handle of the Swap operator.
- asdBlasSswap & asdBlasCswap
Parameter
Input/Output
Type
Description
handle
Input
asdBlasHandle
Handle of the Swap operator.
n
Input
const int64_t
Number of elements in vector x (or y)
x
Input/Output
aclTensor *
x in the formula, which is a tensor on the device. The data format can be ND, and the shape is [n].
- For Sswap, the supported data type is FLOAT32.
- For Cswap, the supported data type is COMPLEX64.
incx
Input
const int64_t
Memory address increment between consecutive elements of x (currently restricted to 1).
y
Input
/Output
aclTensor *
y in the formula, which is a tensor on the device. The data format can be ND, and the shape is [n].
- For Sswap, the supported data type is FLOAT32.
- For Cswap, the supported data type is COMPLEX64.
incy
Input
const int64_t
Memory address increment between consecutive elements of y (currently restricted to 1).
Return Value Description
For details about the return values, see Return Value.
Constraints
- asdBlasMakeSwapPlan: none.
- asdBlasSswap
- The input and output data formats, data types, and shapes must be consistent.
- The input element count n currently supports the range [1, 6.71e+07].
- The input shape of the operator is [n] and [n], and the output shape is [n] and [n].
- The operator does not support the calculation for three or more dimensions.
- asdBlasCswap
- The input and output data formats, data types, and shapes must be consistent.
- The input element count n currently supports the range [1, 6.71e+07].
- The input shape of the operator is [n] and [n], and the output shape is [n] and [n].
- The operator does not support the calculation for three or more dimensions.
Calling Example
For details about the operator calling example, see Swap.
