評價此頁

torch.utils.swap_tensors#

torch.utils.swap_tensors(t1, t2)[source]#

此函式交換兩個 Tensor 物件的內容。從高層次來看,這將使 t1 擁有 t2 的內容,同時保留其自身身份。

如果 t1 和 t2 具有不同的槽,則此操作將無效。