-
Notifications
You must be signed in to change notification settings - Fork 432
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
[Question] Why don't tensors implement the Copy trait? #932
Comments
I don't think |
I see. In retrospect that was a dumb question. I just saw the Tensors are implemented as Arc Arrays. |
Most of the optimizations of Burn are because we use owned tensors as arguments for all our operations. Using the ownership system to know when a tensor can be reused. This allows us to capture the graph and is fundamental in our optimization strategy with the upcoming burn-fusion. So, using tensor as reference would actually make this impossible and slow down the framework. I agree that calling clone when reusing a tensor isn't really pretty, but you can actually use clippy to minimize the number of clones and, in the same way, optimize your model! |
Gotcha! Thanks for the explanation and for your time. Your work here is amazing. Keep going! |
Hi, I was just wondering why tensors implement the
Clone
trait but not theCopy
trait.What is the reason for this?
I just find myself writing
.clone()
over and over again, and I don't see any reason why you couldn't deriveCopy
as well.Thank you for your time.
The text was updated successfully, but these errors were encountered: