-
Notifications
You must be signed in to change notification settings - Fork 6
Description
when I try to run your code, I met some problem about dimension
but I dont know how can I fix it
Traceback (most recent call last):
File "main.py", line 61, in
trainer.train()
File "/content/drive/My Drive/MetaTL-main/trainer.py", line 75, in train
loss, _, _ = self.do_one_step(train_task, iseval=False, curr_rel=curr_rel)
File "/content/drive/My Drive/MetaTL-main/trainer.py", line 54, in do_one_step
p_score, n_score = self.MetaTL(task, iseval, curr_rel)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/content/drive/My Drive/MetaTL-main/models.py", line 116, in forward
loss = self.loss_func(p_score, n_score, y)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/loss.py", line 1323, in forward
return F.margin_ranking_loss(input1, input2, target, margin=self.margin, reduction=self.reduction)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py", line 3316, in margin_ranking_loss
"input1: {}, input2: {}, target: {} ".format(input1.size(), input2.size(), target.size())
RuntimeError: margin_ranking_loss : All input tensors should have same dimension but got sizes: input1: torch.Size([1024, 2]), input2: torch.Size([1024, 2]), target: torch.Size([1])