mindspore.Tensor.copy
- mindspore.Tensor.copy()[源代码]
复制一个Tensor并返回。
警告
2.9.0(不含)之后版本非兼容性变更:接口名需修改为 clone。
说明
当前实现不支持类似NumPy的 order 参数。
- 返回:
复制的Tensor。
- 支持平台:
AscendGPUCPU
样例:
>>> import numpy as np >>> from mindspore import Tensor >>> a = Tensor(np.ones((3,3)).astype("float32")) >>> output = a.copy() >>> print(output) [[1. 1. 1.] [1. 1. 1.] [1. 1. 1.]]