sciai.architecture.FNO1D

View Source On Gitee
class sciai.architecture.FNO1D(in_channels, out_channels, resolution, modes, channels=20, depths=4, mlp_ratio=4, dtype=ms.float32)[source]

The 1-dimensional Fourier Neural Operator (FNO1D) contains a lifting layer, multiple Fourier layers and a decoder layer. The details can be found in Fourier neural operator for parametric partial differential equations.

Parameters
  • in_channels (int) – The number of channels in the input space.

  • out_channels (int) – The number of channels in the output space.

  • resolution (int) – The spatial resolution of the input.

  • modes (int) – The number of low-frequency components to keep.

  • channels (int) – The number of channels after dimension lifting of the input. Default: 20.

  • depths (int) – The number of FNO layers. Default: 4.

  • mlp_ratio (int) – The number of channels lifting ratio of the decoder layer. Default: 4.

  • dtype (dtype.Number) – The computation type of dense. It should be ms.float16 or ms.float32. ms.float32 is recommended for the GPU backend, and ms.float16 is recommended for the Ascend backend. Default: ms.float32.

Inputs:
  • x (Tensor) - Tensor of shape \((batch\_size, resolution, in\_channels)\).

Outputs:

Tensor, the output of FNO network.

  • output (Tensor) -Tensor of shape \((batch\_size, resolution, out\_channels)\).

Raises
Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindspore.common.initializer import initializer, Normal
>>> from sciai.architecture.neural_operators import FNO1D
>>> B, W, C = 32, 1024, 1
>>> x = initializer(Normal(), [B, W, C])
>>> net = FNO1D(in_channels=1, out_channels=1, resolution=64, modes=12)
>>> output = net(x)
>>> print(output.shape)
(32, 1024, 1)