I get the error below
RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x256 and 3x256)
for this line of my code x = F.relu(self.linear1(c))
from snippet below:
class Test(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Test, self).__init__()
self.linear1 = nn.Linear(input_size, hidden_size)
self.linear2 = nn.Linear(hidden_size, hidden_size)
self.linear3 = nn.Linear(hidden_size, output_size)
def forward(self, c):
x = F.relu(self.linear1(c))
x = F.relu(self.linear2(x))
x = torch.tanh(self.linear3(x))
return x
Can anyone give me a clue how to solve this?