0

I have built the following model:

class Net2nn(nn.Module):
    def __init__(self):
        super(Net2nn, self).__init__()
        self.fc1 = nn.Linear(31, 200)
        self.fc2 = nn.Linear(200, 200)
        self.fc3 = nn.Linear(200, 31)

    
    def forward(self, x):
        x = x.to(torch.float32)
        # x = nn.Flatten(1, -1)(x)
        x = F.relu(self.fc1(x.float()))
        x = F.relu(self.fc2(x.float()))
        x = self.fc3(x.float())
        return x.float()

when I want to train my data which its shape is: (11, 31)

I got the following error

RuntimeError: mat1 and mat2 shapes cannot be multiplied (11x31 and 6200x200)

Can anyone give me advice? I would be very grateful

And I want to ask if I can train different subsets of data with a different shapes in one specific built model.

Asraa A
  • 9
  • 2
  • 2
    `Net2nn()(torch.ones((11,31)))` runs without errors for me, as does `Net2nn()(torch.ones((11,31)).unsqueeze(0))`. Could you add details to your example so we can reproduce the error? – Seon Nov 11 '22 at 13:18

0 Answers0