megengine.functional.copy# copy(inp, device=None)[源代码]# 把张量复制到另一个设备上。 参数: inp – 输入张量。 device – 目标设备。 实际案例 >>> import numpy as np >>> x = Tensor([1, 2, 3], np.int32) >>> F.copy(x, 'cpu1') Tensor([1 2 3], dtype=int32, device=cpu1:0) >>> F.copy(x, 'xpu0') Tensor([1 2 3], dtype=int32, device=xpu0:0)