I have already build my network and now I would like to pass input to network. My forward() method looks:
def forward(self, input, index=None): if index is not None: #Do something else: #Do something else
And the way I pass input to network is:
output = net(input, 1)
And this leads to problem as index is still ‘None’ even I pass value ‘1’ to network.
After searching online, it seems that forward() method can only accept input in Variable type.
Therefore it seems alright after I modified the codes as following:
output = net(input, Variables(torch.IntTensor()))
However, is there any simpler way of doing this? Thank you for your time.