class Net(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(M, N)
self.conv1 = nn.Conv2d(1, 64, 2, 1) #1 input channel, 64 output channel, kernel size 2, stride length 1
self.conv2 = nn.Conv2d(64, 32, 2, 1)
self.conv3 = nn.Conv2d(32, 1, 2, 1)
def forward(self, x):
x = F.relu(self.fc1(x))
x = x.view(int(math.sqrt(N)), -1)
x = F.relu(self.conv1(x))
x = F.relu(self.conv2(x))
x = F.relu(self.conv3(x))
return x
model = Net().to(device).double()
x_train = x_train.double() #torch.Size([1000, 25])
y_train = y_train.double() #torch.Size([1000, 5])
x_pred = model.forward(y_train[0])
I am getting this error:
RuntimeError: Expected 4-dimensional input for 4-dimensional weight 64 1 2 2, but got 2-dimensional input of size [5, 5] instead
in:
—> 12 x = F.relu(self.conv1(x))
Can you all please suggest what I am doing wrong? Thanks!