Skip to content

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.

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

Successfully merging this pull request may close these issues.

2 participants