Skip to content

Demo code running issue #7

Open

Description

@linanzhang

Hello,

I played around with the parameters in the demo code and got a RuntimeError. When uploading the dataset and building the network, I changed t_in and t_out:

train_loader, test_loader = kp.data.navier_stokes(data_path, batch_size = 10, T_in = t_in, T_out = t_out, type = "1e-3", sub = 1)

koopman_model = kp.model.koopman(backbone = "KNO2d", autoencoder = "MLP", o = o, m = m, r = r, t_in = t_in, device = device)

An error message promts when calling koopman_model.train(), saying

RuntimeError: The size of tensor a (163840) must match the size of tensor b (122880) at non-singleton dimension 1

The error message is the same regarless of the value of t_in and t_out. What are the requirements on t_in and t_out?

Thank you.

Activity

  1. Williamlliw commented on Jun 24, 2025

    @Williamlliw

    I have encountered the same problem as you when modifying T_in and T_out. I'm not sure if our codes are the same, but I'll just describe the problem I encountered and how I solved it.

    The author uses T_in and T_out as input parameters multiple times in the functions for training, testing, and generating data. However, they are set as default input parameters. This means that if you don't specify the values of T_in and T_out when calling the functions, the functions will automatically use the default values. This may lead to a mismatch in the dimensions of the training and data generation.

    I checked the code of these functions and then assigned values to T_in and T_out when calling the functions for training, testing, and generating data. This solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions