PyTorch noobie here. I'm following an online tutorial and there's a simple model definition as follows:
class BagOfWordsClassifier(nn.Module):
def __init__(self, vocab_size, hidden1, hidden2):
super(BagOfWordsClassifier, self).__init__()
self.fc1 = nn.Linear(vocab_size, hidden1)
self.fc2 = nn.Linear(hidden1, hidden2)
self.fc3 = nn.Linear(hidden2, 1)
def forward(self, inputs):
x = F.relu(self.fc1(inputs.squeeze(1).float()))
x = F.relu(self.fc2(x))
return self.fc3(x)
What I don't understand here is why do we need inputs.squeeze(1) at the forawrd function? When I take it out it gives me the following error:
"addmm_cuda" not implemented for 'Long'
If you need additional info don't hesitate to ask.