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

cat(): argument 'tensors' (position 1) must be tuple of Tensors, not generator #4

Open
caoxu915683474 opened this issue Jun 25, 2018 · 3 comments

Comments

@caoxu915683474
Copy link

left_sents = torch.cat((dict[word].view(1, -1) for word in lsent))

cat(): argument 'tensors' (position 1) must be tuple of Tensors, not generator

can I fix this bug use this line?

torch.cat(tuple([dict[word].view(1, -1) for word in lsent]))

@caoxu915683474
Copy link
Author

torch.cat([dict[word].view(1, -1) for word in lsent])

is this also ok ?

@lanwuwei
Copy link
Owner

Hi caoxu, I tried your second answer in other code:
https://github.com/lanwuwei/Subword-PWIM/blob/6e9ef11fa404c4ea6e350f8e75f7d1055869d8d9/model.py#L436
In my PyTorch version 0.4.0, both are OK. You can modify the code based on your version.

@caoxu915683474
Copy link
Author

@lanwuwei
Thanks for your help, I find my pytorch version is not 0.4.0.

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

2 participants