Rate this Page
โ˜… โ˜… โ˜… โ˜… โ˜…

Identity#

class torch.nn.Identity(*args, **kwargs)[source]#

A placeholder identity operator that is argument-insensitive.

Parameters
  • args (Any) โ€“ any argument (unused)

  • kwargs (Any) โ€“ any keyword argument (unused)

Shape:
  • Input: (โˆ—)(*), where โˆ—* means any number of dimensions.

  • Output: (โˆ—)(*), same shape as the input.

Examples:

>>> m = nn.Identity(54, unused_argument1=0.1, unused_argument2=False)
>>> input = torch.randn(128, 20)
>>> output = m(input)
>>> print(output.size())
torch.Size([128, 20])
forward(input)[source]#

Runs the forward pass.

Return type

Tensor