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. CPU and GPU execution use the same full-spectrum model and spectral parameter layout, with separate real and imaginary tensors. The runtime selects how the operations are executed.

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

        Spectral mode budget.

        The full-spectrum model uses this as the width of each end band on both CPU and GPU.

        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
                @[reducible, inline]

                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.

                                    The record keeps optimizer/log settings, tensor paths, and output artifacts as separate named concerns.

                                    Instances For

                                      All required dataset files for this run.

                                      Instances For

                                        Parse the FNO Burgers command-line options.

                                        Instances For

                                          Effective CUDA-memory-watch cadence for this run.

                                          Instances For

                                            The experiment record of one run: the model and run settings as config entries, the train and test curves, and the dataset files as notes.

                                            Instances For

                                              The Fourier neural operator this example trains, at the width, mode count and depth fixed by modelConfig.

                                              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

                                                    Two tracked curves, train and test MSE, with the colours the log viewer will use.

                                                    Instances For

                                                      Persist the train/test MSE history as an experiment record.

                                                      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

                                                              Prepare deterministic evaluation prefixes and a cycling stream of training samples.

                                                              Instances For

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

                                                                Instances For

                                                                  Train the same full-spectrum model through the shared trainer on CPU or GPU.

                                                                  Instances For

                                                                    Print the run's configuration: device, model geometry, row counts and file paths.

                                                                    An FNO run that silently loaded the wrong split can look like a training problem. Printing the paths and row counts helps identify the data error.

                                                                    Instances For

                                                                      Train and evaluate with the selected runtime and the shared FNO parameterization.

                                                                      Instances For