torch.utils.swap_tensors
- torch.utils.swap_tensors(t1, t2)[source]
This function swaps the content of the two Tensor objects. At a high level, this will make t1 have the content of t2 while preserving its identity.
This will not work if t1 and t2 have different slots.