mindspore.ops.Identity

class mindspore.ops.Identity[source]

Returns a Tensor with the same shape and contents as input.

Inputs:
  • x (Tensor) - The shape of tensor is \((x_1, x_2, ..., x_R)\). The data type is Number.

Outputs:

Tensor, the shape of tensor and the data type are the same as input_x, \((x_1, x_2, ..., x_R)\).

Raises

TypeError – If x is not a Tensor.

Supported Platforms:

Ascend CPU GPU

Examples

>>> x = Tensor(np.array([1, 2, 3, 4]), mindspore.int64)
>>> output = ops.Identity()(x)
>>> print(output)
[1 2 3 4]