Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Why i get different shape when decoding? #106

Open
fooSynaptic opened this issue Jan 21, 2019 · 3 comments
Open

Why i get different shape when decoding? #106

fooSynaptic opened this issue Jan 21, 2019 · 3 comments

Comments

@fooSynaptic
Copy link

fooSynaptic commented Jan 21, 2019

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

@fooSynaptic fooSynaptic changed the title W Why i get different shape when decoding? Jan 21, 2019
@fooSynaptic
Copy link
Author

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?

@zhanqiuzhang
Copy link

@fooSynaptic
features = torch.cat((u, v, torch.abs(u - v), u * v), 1)
so 16384 = 4096 * 4

@fooSynaptic
Copy link
Author

fooSynaptic commented Jan 22, 2019

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants