I have a basic doubt regarding the syntax of the code while passing the input to the Linear model. Following is the code that I got from documentation.
m = nn.Linear(20, 30) //Line1
input = torch.randn(128, 20)//Line2
output = m(input) //Line3
Now my doubt is:
in Line1, m is the object that we created by sending the parameters (20, 30) to the init of the nn.Linear class. Now, in Line3 while passing the inputs how are we able to pass the inputs by calling m(inputs), as m is an object? Instead, what I think should have been the correct procedure for passing the inputs is:
output = m.forward(input)
Please clarify their approach as its a bit unclear to me and this is something that they have used throughout the documentation.