Skip to content

Type error in docs/notebooks/01-using-solvers.ipynb #39

@meyer-nils

Description

@meyer-nils

During testing for the review (openjournals/joss-reviews#9733), I noticed a TypeError in one of the notebooks:

     20 def custom_step_function(c, t):
---> [21](vscode-notebook-cell:?execution_count=17&line=22)     c = torch.clip(c, 0, 1)
     22     mu_hom = 18 / eps * c * (1 - c) * (1 - 2 * c)
     23     c_hat = fft.fftn(c)

TypeError: clip() received an invalid combination of arguments - got (int, int, int), but expected one of:
 * (Tensor input, Tensor min = None, Tensor max = None, *, Tensor out = None)
 * (Tensor input, Number min = None, Number max = None, *, Tensor out = None)

Looking at TimeDependentSolver.solve(), this seems to be caused by a mismatch of the call signatures for the step function. Swapping c and t in the custom step function resolves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions