Skip to content

error when batchsize=1 #5

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

error when batchsize=1 #5

wants to merge 1 commit into from

Conversation

zengxianyu
Copy link

#4

line 135 in skip-thoughts.torch/pytorch/skipthoughts/skipthoughts.py lengths = list(max_length - input.data.eq(0).sum(1).squeeze()) will raise an error if the batch size is 1, saying ``typeError: iteration over a 0-d tensor''

@shenyedepisa
Copy link

I also encountered this error. When the input dimension is (1, n), the result of max_length-input.data.eq(0).sum(1).squeeze() is a scalar, and list( ) will report an error of "typeError: iteration over a 0-d tensor ".
I think your submission is correct. It solves the problem.

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

Successfully merging this pull request may close these issues.

2 participants