Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling $detach() discards attributes #1136

Closed
sebffischer opened this issue Feb 12, 2024 · 2 comments
Closed

Calling $detach() discards attributes #1136

sebffischer opened this issue Feb 12, 2024 · 2 comments

Comments

@sebffischer
Copy link
Collaborator

library(torch)

x = nn_parameter(torch_randn(1))
class(x)
#> [1] "torch_tensor" "R7"           "nn_parameter"
class(x$detach())
#> [1] "torch_tensor" "R7"

Created on 2024-02-12 with reprex v2.0.2

@dfalbel
Copy link
Member

dfalbel commented Feb 20, 2024

We could use a similar approach to what we did for clone, right?

@sebffischer
Copy link
Collaborator Author

Yes, I will PR it. Just noted it down here so it won't be forgotten and I did not want to include even more changes in the cloning PR.

sebffischer added a commit to sebffischer/torch that referenced this issue Feb 20, 2024
sebffischer added a commit to sebffischer/torch that referenced this issue Feb 20, 2024
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

No branches or pull requests

2 participants