mindspore.numpy.copy

View Source On Gitee
mindspore.numpy.copy(a)

Returns a tensor copy of the given object.

Parameters

a (Union[int, float, bool, list, tuple, Tensor]) – Input data, in any form that can be converted to a Tensor. This includes Tensor, list, tuple and numbers.

Returns

Tensor, has the same data as a.

Raises
  • TypeError – If input a has type not specified above.

  • ValueError – If input a has different sizes at different dimensions.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> x = np.ones((2,2))
>>> print(np.copy(x))
[[1. 1.]
 [1. 1.]]