Rate this Page

torch.Tensor.copy_#

Tensor.copy_(src,non_blocking=False)Tensor#

Copies the elements fromsrc intoself tensor and returnsself.

Thesrc tensor must bebroadcastablewith theself tensor. It may be of a different data type or reside on adifferent device.

Parameters
  • src (Tensor) – the source tensor to copy from

  • non_blocking (bool,optional) – ifTrue and this copy is between CPU and GPU,the copy may occur asynchronously with respect to the host. For othercases, this argument has no effect. Default:False