mindspore.nn.Identity

View Source On Gitee
class mindspore.nn.Identity(*args, **kwargs)[source]

A placeholder identity operator that returns the same as input.

Parameters
  • args (Any) – Any argument.

  • kwargs (Any) – Any keyword argument.

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

Outputs:

The same as input.

Supported Platforms:

Ascend GPU CPU

Examples

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