TorchLean API

NN.Examples.Models.Operators.Fno1dBurgers

Native TorchLean FNO1D Burgers #

Read this after the basic CNN/MLP examples if you want the operator-learning path. The Python scripts do the two jobs Lean should not own here: download and reshape the public burgers_data_R10.mat file, then plot the prediction CSV. The model, loss, optimizer, and training loop stay in TorchLean.

This executable uses real-split Fourier arithmetic because the Burgers data are real-valued. The portable path evaluates the dense multidimensional DFT with separate real and imaginary tensors. On CUDA, the fused spectralConv1dRfft autograd primitive uses the same representation for its weights and executes the transforms through cuFFT.

The training task follows the standard FNO Burgers setup: learn the operator $u_0(x)\mapsto u(x,T)$ on a fixed periodic grid. The default grid and row counts are modest enough for a local run while still exercising the real operator-learning path. Larger runs can raise --steps, export more rows, and bump the constants below.

References for the dataset/training convention:

CLI subcommand name used in terminal banners and errors.

Instances For

    Spatial grid resolution used by the prepared Burgers .npy slices.

    Instances For

      Channel width inside the compact FNO block.

      Instances For

        Number of Fourier modes retained on each side of the real FFT spectrum.

        Instances For

          Number of spectral blocks used by the compact training run.

          Instances For

            Default number of training rows expected from the preparation script.

            Instances For

              Default number of held-out rows expected from the preparation script.

              Instances For

                Spec.Shape-level FNO configuration shared by the constructor and sample loaders.

                Instances For
                  @[reducible, inline]

                  Model input shape: one sampled initial condition on the fixed grid.

                  Instances For
                    @[reducible, inline]

                    Model output shape: one predicted terminal solution on the same grid.

                    Instances For

                      Directory where the preparation script writes Burgers tensors by default.

                      Instances For

                        Default training input tensor path.

                        Instances For

                          Default training target tensor path.

                          Instances For

                            Default held-out input tensor path.

                            Instances For

                              Default held-out target tensor path.

                              Instances For

                                Default CSV path for the prediction-vs-target plot script.

                                Instances For

                                  User-facing hint printed when the prepared Burgers tensors are missing.

                                  Instances For

                                    FNO Burgers command-line options: training flags, data paths, and artifact paths.

                                    Seeded optimizer/log flags come from ModelZoo, the Burgers tensor paths use ModelZoo.PairedNpyEvalFlags, and the plot path uses ModelZoo.CsvArtifactFlags.

                                    Instances For

                                      All required dataset files for this run.

                                      Instances For

                                        Parse the FNO Burgers command-line options.

                                        Instances For

                                          TrainLog note fields for the fused CUDA execution path.

                                          Instances For

                                            Load one fixed-grid Burgers split as supervised TorchLean samples.

                                            Instances For

                                              Write one FNO prediction row to CSV for the companion plotting script.

                                              Instances For

                                                Persist the train/test MSE history with model/data metadata attached.

                                                Instances For

                                                  Loaded train/test splits before evaluation prefixes and cycling streams are derived.

                                                  Instances For

                                                    Validate paths and load both Burgers splits.

                                                    Instances For

                                                      Deterministic evaluation prefixes and cycling stream derived from the loaded train/test sets.

                                                      Instances For

                                                        Convert loaded Burgers datasets into the common runtime/evaluation view used by both execution paths.

                                                        The fused CUDA path:

                                                        • evaluate on fixed deterministic prefixes,
                                                        • train by cycling through the finite dataset with seed + step, and
                                                        • emit the same train/test MSE metric history.
                                                        Instances For

                                                          Push one train/test MSE point into the metric history and print the tagged report line.

                                                          Instances For
                                                            @[reducible, inline]

                                                            Fused CUDA parameter packet for the real-FFT FNO kernel.

                                                            Instances For

                                                              Mean MSE over a finite evaluation prefix using the fused CUDA FNO implementation.

                                                              Instances For

                                                                Train/test MSE pair for the current fused CUDA parameters.

                                                                Instances For

                                                                  Append one fused-CUDA evaluation point to the metric history.

                                                                  Instances For

                                                                    Predict one Burgers terminal field through the fused CUDA spectral path.

                                                                    Instances For

                                                                      Run the fused cuFFT/RFFT training path and emit its training and prediction artifacts.

                                                                      Instances For