I am considering the sample code from the documentation:
import torch
from torch import nn
#
m = nn.Linear(20, 30)
input = torch.randn(128, 20)
output = m(input)
print(output.size())
The output is :
torch.Size([128, 30])
The constructor of Linear is :
def __init__(self, in_features: int, out_features: int, bias: bool = True) -> None:
This is consistent with the way the instance is created, i.e.:
m = nn.Linear(20, 30)
However, when m is used, it receives a tensor
output = m(input)
as input. I do not understand why. Where is this tensor defined in the source code?