FFT_3D

Applicable Products

Hardware Model

Supported or Not

Atlas 200I/500 A2 inference products

Not supported

Atlas inference products

Not supported

Atlas training products

Not supported

Atlas A2 training products/Atlas A2 inference products

Supported

Atlas A3 inference products/Atlas A3 training products

Not supported

Function Description

API function

  • asdFftMakePlan3D: Initializes the 3D FFT configuration.
  • asdFftExecC2C: performs FFT from a complex number to another complex number.
  • asdFftExecC2R: performs FFT from a complex number to a real number.
  • asdFftExecR2C: performs FFT from a real number to a complex number.
  • asdFftExecC2CSeparated: performs FFT from a complex number to another complex number. The real and imaginary parts can be separately input and output.

Formula:

Assume that there is a three-dimensional discrete signal:

Its three-dimensional discrete Fourier transform is defined as follows:

where:

Function Prototype

  • AspbStatus asdFftMakePlan3D(asdFftHandle handle, int64_t fftSizeX, int64_t fftSizeY, int64_t fftSizeZ, asdFftType fftType, asdFftDirection direction, int32_t batchSize)
  • AspbStatus asdFftExecC2C(asdFftHandle handle, const aclTensor *input, const aclTensor *output)
  • AspbStatus asdFftExecC2R(asdFftHandle handle, const aclTensor *input, const aclTensor *output)
  • AspbStatus asdFftExecR2C(asdFftHandle handle, const aclTensor *input, const aclTensor *output)
  • AspbStatus asdFftExecC2CSeparated(asdFftHandle handle, const aclTensor *inputReal, const aclTensor *inputImag,const aclTensor *outputReal, const aclTensor *outputImag)

Parameter Description

  • asdFftMakePlan3D

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdFftHandle

    Handle of the FFT operator. You need to manually create the asdFftHandle object.

    fftSizeX

    Input

    int64_t

    M in the formula, which indicates the FFT signal length (the first dimension).

    fftSizeY

    Input

    int64_t

    N in the formula, which indicates the FFT signal length (the second dimension).

    fftSizeZ

    Input

    int64_t

    N in the formula, which indicates the FFT signal length (the third dimension).

    fftType

    Input

    asdFftType

    FFT type. The options are as follows:

        - ASCEND_FFT_C2C
        - ASCEND_FFT_C2R
        - ASCEND_FFT_R2C
        - ASCEND_FFT_C2C_SEP 

    direction

    Input

    asdFftDirection

    Forward transform or inverse transform:

        - ASCEND_FFT_FORWARD
        - ASCEND_FFT_INVERSE

    batchSize

    Input

    int32_t

    Number of data batches in the FFT batch processing operation.

  • asdFftExecC2C

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdFftHandle

    Handle of the FFT operator. You need to manually create the asdFftHandle object.

    inData

    Input

    const aclTensor *

    x in the formula, which is a tensor on the device. The data type can only be COMPELX64, the data format can be ND, and the input shape is (batchSize, fftSizeX, fftSizeY, fftSizeZ).

    outData

    Output

    aclTensor *

    y in the formula, which is a tensor on the device. The data type can only be COMPELX64, the data format can be ND, and the input shape is (batchSize, fftSizeX, fftSizeY, fftSizeZ).

  • asdFftExecC2R

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdFftHandle

    Handle of the FFT operator. You need to manually create the asdFftHandle object.

    inData

    Input

    const aclTensor *

    x in the formula, which is a tensor on the device. The data type can only be COMPELX64, the data format can be ND, and the input shape is (batchSize, fftSizeX, fftSizeY, fftSizeZ/2+1).

    outData

    Output

    aclTensor *

    y in the formula, which is a tensor on the device. The data type can only be FLOAT32, the data format can be ND, and the input shape is (batchSize, fftSizeX, fftSizeY, fftSizeZ).

  • asdFftExecR2C

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdFftHandle

    Handle of the FFT operator. You need to manually create the asdFftHandle object.

    inData

    Input

    const aclTensor *

    x in the formula, which is a tensor on the device. The data type can only be FLOAT32, the data format can be ND, and the input shape is (batchSize, fftSizeX, fftSizeY, fftSizeZ).

    outData

    Output

    aclTensor *

    y in the formula, which is a tensor on the device. The data type can only be COMPELX64, the data format can be ND, and the input shape is (batchSize, fftSizeX, fftSizeY, fftSizeZ/2+1).

  • asdFftExecC2CSeparated
    AspbStatus asdFftExecC2CSeparated(asdFftHandle handle, const aclTensor *inputReal, const aclTensor *inputImag,const aclTensor *outputReal, const aclTensor *outputImag)

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdFftHandle

    Handle of the FFT operator. You need to manually create the asdFftHandle object.

    inputReal

    Input

    const aclTensor *

    The real part of x in the formula, which is the real part of the input. The data type can only be FLOAT32, the data format can be ND, and the input shape is (batchSize, fftSize).

    inputImag

    Input

    const aclTensor *

    The imaginary part of x in the formula, which is the imaginary part of the input. The data type can only be FLOAT32, the data format can be ND, and the input shape is (batchSize, fftSize).

    outputReal

    Output

    const aclTensor *

    The real part of y in the formula, which is the real part of the output. The data type can only be FLOAT32, the data format can be ND, and the input shape is (batchSize, fftSize).

    outputImag

    Output

    const aclTensor *

    The imaginary part of y in the formula, which is the imaginary part of the output. The data type can only be FLOAT32, the data format can be ND, and the input shape is (batchSize, fftSize).

Return Value Description

For details about the return values, see Return Value.

Constraints

Local update is not supported in FFT_3D. That is, the input tensor and output tensor cannot be the same tensor.

  • asdFftMakePlan3D
    • The values of fftSizeX, fftSizeY, and fftSizeZ must be less than or equal to 2^27 and do not contain prime factors greater than 199.
    • There is no additional restriction on batchSize within the storage scope.
    • The theoretical range of the number of input elements is [1, 2^30].
    • The input elements cannot be inf, -inf, or nan. If the input contains these values, the result is undefined.
  • asdFftExecC2C

    None

  • asdFftExecC2R

    None

  • asdFftExecR2C

    None

  • asdFftExecC2CSeparated

    The signal length range is [2, 256].

Calling Example

For details about the operator calling example, see FFT_3D.