Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid argument 2: view size is not compatible with input tensor's size and stride #3

Open
jkkl opened this issue Jul 5, 2019 · 1 comment

Comments

@jkkl
Copy link

jkkl commented Jul 5, 2019

**** Training Begins ****
**** Epoch 0/50 ****
Train init with 1521 batches with 0 left over samples
Train add with 30 warm up batches
/home/yuanzhuo.wyz/.conda/envs/yizhen27/lib/python2.7/site-packages/torch/nn/functional.py:995: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
Traceback (most recent call last):
File "simdial-zsdg.py", line 174, in
main(config)
File "simdial-zsdg.py", line 156, in main
train(model, train_feed, valid_feed, test_feed, config, evaluator, gen=hred_utils.generate)
File "/home/yuanzhuo.wyz/humanlike/neuraldialog-ZSDG/zsdg/main.py", line 105, in train
loss = model(batch, mode=TEACH_FORCE)
File "/home/yuanzhuo.wyz/.conda/envs/yizhen27/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/yuanzhuo.wyz/humanlike/neuraldialog-ZSDG/zsdg/models/models.py", line 499, in forward
mode=mode, gen_type=gen_type)
File "/home/yuanzhuo.wyz/.conda/envs/yizhen27/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/yuanzhuo.wyz/humanlike/neuraldialog-ZSDG/zsdg/enc2dec/decoders.py", line 443, in forward
decoder_input, decoder_hidden, attn_context, attn_words, ctx_embed)
File "/home/yuanzhuo.wyz/humanlike/neuraldialog-ZSDG/zsdg/enc2dec/decoders.py", line 362, in forward_step
rnn_softmax = F.softmax(self.project(output.view(-1, self.hidden_size)), dim=1)
RuntimeError: invalid argument 2: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Call .contiguous() before .view(). at /opt/conda/conda-bld/pytorch_1532571898140/work/aten/src/THC/generic/THCTensor.cpp:226
(yizhen27)

@jkkl
Copy link
Author

jkkl commented Jul 5, 2019

when I run command
python simdial-zsdg.py

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

No branches or pull requests

1 participant