NeuroDiffGym / neurodiffeq

A library for solving differential equations using neural networks based on PyTorch, used by multiple research groups around the world, including at Harvard IACS.
http://pypi.org/project/neurodiffeq/
MIT License
680 stars 89 forks source link

Error for temporal-test.ipynb #132

Closed mansura-habiba closed 3 years ago

mansura-habiba commented 3 years ago
  1. Download the git repo as zip
  2. Run all cells for https://github.com/NeuroDiffGym/neurodiffeq/blob/master/experiments/temporal-test.ipynb
  3. on 4th cell got the following error
    ~/Documents/My Documents/neurodiffeq-master/neurodiffeq/neurodiffeq.py in safe_diff(u, t, order)
     51     """
     52     if len(u.shape) != 2 or len(t.shape) != 2 or u.shape[1] != 1 or t.shape[1] != 1:
    ---> 53         raise ValueError(f"Input shapes must both be (n_samples, 1) starting from neurodiffeq v0.2.0; \n"
     54                          f"got {u.shape} (for dependent variable) and {t.shape} (for independent variable)"
     55                          f"In most scenarios, consider reshaping inputs by `x = x.view(-1, 1)`\n"

    t.shape[1] is throwing IndexOutoound Error. For both u and t , shape.size =1 and shape is 64

It was working fine few days ago. Is there some new changes that is causing this issue?

shuheng-liu commented 3 years ago

Hi @mansura-habiba the experiments folder is old and codes in it haven't been updated much for a year (or more).

Since v0.2 neurodiffeq requires both inputs to diff to have shape (N_samples,1)

If you want a quick tutorial to get started with neurodiffeq, we recommend checking out our official documentation here or the README file. Both of them are up to date.