victorywys / RAVEN

61 stars 22 forks source link

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 300 and 0 in dimension 1 #7

Open gjyao opened 5 years ago

gjyao commented 5 years ago
def __getitem__(self, index):
        inputLen = self.wordLength[index]
        return torch.cat((torch.tensor(self.wordInput[index], dtype=torch.float32), torch.zeros((gc.padding_len - len(self.wordInput[index]), gc.wordDim))), 0),\
                torch.cat((torch.tensor(self.covarepInput[index], dtype=torch.float32), torch.zeros((gc.padding_len - len(self.covarepInput[index]), gc.shift_padding_len, gc.covarepDim))), 0),\
                torch.cat((torch.tensor(self.covarepLength[index], dtype=torch.long), torch.zeros(gc.padding_len - len(self.covarepLength[index]), dtype=torch.long)), 0),\
                torch.cat((torch.tensor(self.facetInput[index], dtype=torch.float32), torch.zeros((gc.padding_len - len(self.facetInput[index]), gc.shift_padding_len, gc.facetDim))), 0),\
                torch.cat((torch.tensor(self.facetLength[index], dtype=torch.long), torch.zeros(gc.padding_len - len(self.facetLength[index]), dtype=torch.long)), 0),\
                inputLen, torch.tensor(self.labelOutput[index]).squeeze()

When I ran main.py,I got this error. It seems like there's some problem in the overrride function getiem?

alfonsoindurain commented 2 years ago

Hi, I am having the same problem. Any solution?

ttrikn commented 1 year ago

Hi, I am having the same problem. Any solution?

Hello,I meet the same problem,how did you specifically sove it?