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

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