Skip to content

Conversation

@tianyeeT
Copy link

No description provided.

@lululxvi
Copy link
Owner

Does this code work well for PyTorch?

@tianyeeT
Copy link
Author

Does this code work well for PyTorch?

Yeah, I tested it locally, and it turned out well.

@vl-dud
Copy link
Contributor

vl-dud commented Sep 29, 2025

Maybe you can use just sin = dde.backend.sin instead of

# Define sine function
if dde.backend.backend_name in ["tensorflow.compat.v1", "tensorflow"]:
    from deepxde.backend import tf

    sin = tf.sin
elif dde.backend.backend_name == "jax":
    import jax

    sin = jax.numpy.sin
elif dde.backend.backend_name == "paddle":
    import paddle

    sin = paddle.sin
elif dde.backend.backend_name == "pytorch":
    import torch

    sin = torch.sin

@lululxvi
Copy link
Owner

lululxvi commented Oct 1, 2025

Does this code work well for PyTorch?

Yeah, I tested it locally, and it turned out well.

Then update the first line of the file by adding pytorch, similar to other examples.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants