You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe Tensors are immutable. You can build them up from vectors or iterators but I think it's difficult and maybe impossible to mutate specific elements.
@DimitriTimoz yes, tensors are immutable. The way to change the value of a specific element would be to use the Tensor::slice_assign method, which returns a new (copied) tensor. This requires a tensor to copy as the replacement tensor. If this code is in a hot loop and the device is a GPU, I would recommend that you avoid recreating this replacement tensor to avoid device<>host synchronization.
Maybe it's a dumb question and I just didn't well read the doc but Is it possible to assign a value at a position in a tensor?
Something like that:
The text was updated successfully, but these errors were encountered: