copy_to

Tensor.copy_to(tensor)

Copies the tensor data of the current Tensor object to another Tensor object.

Notes

  • Before calling this method, make sure the format, shape, and data type of source and target tensors are identical and valid.

  • This function automatically handles data alignment when required.

Parameters:

tensor (Tensor) -- The Tensor object to copy to.

Note

Data may be modified during copying from the source to target due to differences in device type, contiguity requirements, and other data characteristics.