mindscience.sciops.dft.DFTn
- class mindscience.sciops.dft.DFTn(shape, dim=None, norm='backward', modes=None, compute_dtype=mstype.float32)[source]
1/2/3D discrete Fourier transformation on complex number. The results should be same as scipy.fft.fftn() .
- Parameters
shape (tuple) – The shape of the dimensions to be transformed, other dimensions need not be included.
dim (tuple) – Dimensions to be transformed. Default:
None, the trailing dimensions will be transformed.norm (str) – Normalization mode, should be one of 'forward', 'backward', 'ortho'. Default:
'backward', same as torch.fft.irfftnmodes (Union[tuple, int, None]) – The length of the output transform axis. The modes must be no greater than half of the dimension of input 'x'. Default:
None.compute_dtype (mindspore.dtype) – The type of input tensor. Default:
mstype.float32.
- Inputs:
ar (Tensor) - Real part of the tensor to be transformed, with trailing dimensions aligned with shape.
ai (Tensor) - Imag part of the tensor to be transformed, with trailing dimensions aligned with shape.
- Outputs:
br (Tensor) - Real part of the output tensor, with trailing dimensions aligned with shape.
bi (Tensor) - Imag part of the output tensor, with trailing dimensions aligned with shape.
Examples
>>> from mindspore import ops >>> from mindflow.cell import DFTn >>> ar = ops.rand((2, 32, 512)) >>> ai = ops.rand((2, 32, 512)) >>> dft_cell = DFTn(ar.shape[-2:]) >>> br, bi = dft_cell(ar, ai) >>> print(br.shape) (2, 32, 512)