mindspore.nn.Identity

class mindspore.nn.Identity[source]

A placeholder identity operator that returns the same as input.

Inputs:
  • x (Any) - The input of Identity.

Outputs:

The same as x.

Supported Platforms:

Ascend GPU CPU

Examples

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