I am trying to implement a simple linear network. The input tensor size is (B,3,64,64) My network is defined like this. tensorSize = x.size() input = tensorSize[0] * tensorSize[1] * tensorSize[2] self.linear_one = torch.nn.Linear(64, input) self.linear_two = torch.nn.Linear(input, 32) self.linear_output = torch.nn.Linear(32, 6) self.layer_in = self.linear_one(x) self.layer_in_two = self.linear_two(self.layer_in) self.layer_out = self.linear_output(self.layer_in_two) My output is size (B,3,64,6) but it needs to be (B,6) Why is my network not outputting the correct results? source https://stackoverflow.com/questions/76984392/the-size-of-tensor-a-100-must-match-the-size-of-tensor-b-64-at-non-singleton
A site where you can share knowledge