torch.Tensor中的clone()方法
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.
快去成为你想要的样子!
浙公网安备 33010602011771号