mindflow.cell.FNO2D

class mindflow.cell.FNO2D(in_channels, out_channels, resolution, modes, channels=20, depths=4, mlp_ratio=4, compute_dtype=mstype.float32)[source]

The 2-dimensional Fourier Neural Operator (FNO2D) 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.

  • compute_dtype (dtype.Number) – The computation type of dense. Default: mindspore.common.dtype.float32. Should be mindspore.common.dtype.float32 or mindspore.common.dtype.float32. float32 is recommended for the GPU backend, float16 is recommended for the Ascend backend.

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

Outputs:

Tensor, the output of this FNO network.

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

Raises
Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindspore.common.initializer import initializer, Normal
>>> from mindflow.cell.neural_operators import FNO2D
>>> B, H, W, C = 32, 64, 64, 1
>>> input = initializer(Normal(), [B, H, W, C])
>>> net = FNO2D(in_channels=1, out_channels=1, resolution=64, modes=12)
>>> output = net(input)
>>> print(output.shape)
(32, 64, 64, 1)