copy¶
- tripy.copy(input: Tensor, device: device) Tensor [source]¶
Returns a copy of the input tensor on the target device.
- Parameters:
- Returns:
[dtype=T1] A copy of input tensor on target device.
- Return type:
Example
1input = tp.Tensor([1, 2], device=tp.device("gpu")) 2output = tp.copy(input, tp.device("cpu"))
>>> input tensor([1, 2], dtype=int32, loc=gpu:0, shape=(2,)) >>> output tensor([1, 2], dtype=int32, loc=cpu:0, shape=(2,))