Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindflow.cell.FNO1D

View Source On Gitee
class mindflow.cell.FNO1D(in_channels, out_channels, n_modes, resolutions, hidden_channels=20, lifting_channels=None, projection_channels=128, n_layers=4, data_format='channels_last', fnoblock_act='gelu', mlp_act='gelu', add_residual=False, positional_embedding=True, dft_compute_dtype=mstype.float32, fno_compute_dtype=mstype.float16)[source]

The 1D Fourier Neural Operator, which usually contains a Lifting Layer, a Fourier Block Layer and a Projection Layer. The details can be found in Zongyi Li, et. al: 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.

  • n_modes (Union[int, list(int)]) – The number of modes reserved after linear transformation in Fourier Layer.

  • resolutions (Union[int, list(int)]) – The resolutions of the input tensor.

  • hidden_channels (int) – The number of channels of the FNOBlock input and output. Default: 20.

  • lifting_channels (int) – The number of channels of the lifting layer mid channels. Default: None.

  • projection_channels (int) – The number of channels of the projection layer mid channels. Default: 128.

  • n_layers (int) – The number that Fourier Layer nests. Default: 4.

  • data_format (str) – The input data channel sequence. Default: "channels_last". Support value: "channels_last", "channels_first".

  • fnoblock_act (Union[str, class]) – The activation function for FNOBlock, could be either str or class. Default: "gelu".

  • mlp_act (Union[str, class]) – The activation function for MLP layers, could be either str or class. Default: gelu.

  • add_residual (bool) – Whether to add residual in FNOBlock or not. Default: False.

  • positional_embedding (bool) – Whether to embed positional information or not. Default: True.

  • dft_compute_dtype (dtype.Number) – The computation type of DFT in SpectralConvDft. Default: mstype.float32.

  • fno_compute_dtype (dtype.Number) – The computation type of MLP in fno skip. Default: mstype.float16. Should be mstype.float32 or mstype.float16. mstype.float32 is recommended for the GPU backend, mstype.float16 is recommended for the Ascend backend.

Inputs:
  • x (Tensor) - Tensor of shape (batch_size,resolution,in_channels).

Outputs:

Tensor, the output of this FNOBlocks.

  • output (Tensor) -Tensor of shape (batch_size,resolution,out_channels).

Raises
  • TypeError – If in_channels is not an int.

  • TypeError – If out_channels is not an int.

  • TypeError – If hidden_channels is not an int.

  • TypeError – If lifting_channels is not an int.

  • TypeError – If projection_channels is not an int.

  • TypeError – If n_layers is not an int.

  • TypeError – If data_format is not a str.

  • TypeError – If add_residual is not an bool.

  • TypeError – If positional_embedding is not an bool.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> import mindspore
>>> import mindflow
>>> from mindspore import Tensor
>>> import mindspore.common.dtype as mstype
>>> from mindflow.cell import FNO1D
>>> data = Tensor(np.ones([2, 128, 3]), mstype.float32)
>>> net = FNO1D(in_channels=3, out_channels=3, n_modes=[20], resolutions=[128])
>>> out = net(data)
>>> print(data.shape, out.shape)
(2, 128, 3) (2, 128, 3)