clone
() → Tensor
Returns a copy of the self
tensor. The copy has the same size and data type as self
.
NOTE
Unlike copy_(), this function is recorded in the computation graph. Gradients propagating to the cloned tensor will propagate to the original tensor.
返回一個張量的副本,其與原張量的尺寸和數據類型相同。
與copy_()不同,這個函數記錄在計算圖中。傳遞到克隆張量的梯度將傳播到原始張量。
copy_
(src, non_blocking=False) → Tensor
Copies the elements from src
into self
tensor and returns self
.
The src
tensor must be broadcastable with the self
tensor. It may be of a different datatype or reside on a different device.