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.

sciai.architecture.FNO2D

View Source On Gitee
class sciai.architecture.FNO2D(in_channels, out_channels, resolution, modes, channels=20, depths=4, mlp_ratio=4, dtype=ms.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.

  • 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,resolution,in_channels).

Outputs:

Tensor, the output of this FNO network.

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

Raises
  • TypeError – If in_channels is not an int.

  • TypeError – If out_channels is not an int.

  • TypeError – If resolution is neither an int nor a tuple of int.

  • TypeError – If modes is not an int.

  • ValueError – If modes is less than 1.

Supported Platforms:

Ascend GPU

Examples

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