Open fooSynaptic opened 5 years ago
And i was confused with the parameters in the Nlinet:
NLINet( (encoder): InferSent( (enc_lstm): LSTM(300, 2048, bidirectional=True) ) (classifier): Sequential( (0): Linear(in_features=16384, out_features=512, bias=True) (1): Linear(in_features=512, out_features=512, bias=True) (2): Linear(in_features=512, out_features=2, bias=True) ) )
why the classfier begin with a input feature of 16384?
@fooSynaptic
features = torch.cat((u, v, torch.abs(u - v), u * v), 1)
so 16384 = 4096 * 4
@zhanqiuzhang ha, you are right bro. But the major issue in the title still not fixed. I just pack the tensor to sample shape with random float. It worked with deficiency in performance.
I use the infersent to train my corpus but got different shape while decode, I donnt know why.
VALIDATION : Epoch 1 Traceback (most recent call last): File "train_entail.py", line 319, in <module> eval_acc = evaluate(epoch, 'valid') File "train_entail.py", line 276, in evaluate output = nli_net((s1_batch, s1_len), (s2_batch, s2_len)) File "/data2/sda/jiaxin_hu/git_project/lib/python3.5/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "/data2/sde/jiaxin_hu/git_project/InferSent/models.py", line 1036, in forward features = torch.cat((u, v, torch.abs(u-v), u*v), 1) RuntimeError: The size of tensor a (64) must match the size of tensor b (33) at non-singleton dimension 0