Skip to content

TypeError: cat received an invalid combination of arguments - got (list, int), but expected one of: #29

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

Closed
kierkegaard13 opened this issue Jun 28, 2018 · 3 comments

Comments

@kierkegaard13
Copy link

kierkegaard13 commented Jun 28, 2018

I'm trying to run your example for SAM, but I'm running into the following error:

Traceback (most recent call last):
  File "dnc_test.py", line 20, in <module>
    rnn(torch.randn(10, 4, 64), (controller_hidden, memory, read_vectors), reset_experience=True)
  File "/home/xxx/miniconda3/envs/my_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/xxx/git_repos/pytorch-dnc/dnc/dnc.py", line 222, in forward
    inputs = [T.cat([input[:, x, :], last_read], 1) for x in range(max_length)]
  File "/home/xxx/git_repos/pytorch-dnc/dnc/dnc.py", line 222, in <listcomp>
    inputs = [T.cat([input[:, x, :], last_read], 1) for x in range(max_length)]
TypeError: cat received an invalid combination of arguments - got (list, int), but expected one of:
 * (sequence[torch.cuda.FloatTensor] seq)
 * (sequence[torch.cuda.FloatTensor] seq, int dim)
      didn't match because some of the arguments have invalid types: (list, int)

I tried loading the input tensor onto the gpu with .cuda() and transforming last_read to a Tensor with .data, but that led to other issues.

There's also a typo in your documentation:

output, (controller_hidden, memory, read_vectors) = \
  rnn(torch.randn(10, 4, 64), (controller_hidden, memory, read_vectors, reset_experience=True))

should be

output, (controller_hidden, memory, read_vectors) = \
  rnn(torch.randn(10, 4, 64), (controller_hidden, memory, read_vectors), reset_experience=True)
@ixaxaar
Copy link
Owner

ixaxaar commented Jun 29, 2018

@kierkegaard13 may I know your pytorch version? import torch; torch.__version__
Also could you create a PR for the documentation fix?

@kierkegaard13
Copy link
Author

@ixaxaar I'm using 0.3.1. And yeah, I can create a PR for the doc fix.

@ixaxaar
Copy link
Owner

ixaxaar commented Apr 5, 2019

Closing, as doc is fixed. Thanks!

@ixaxaar ixaxaar closed this as completed Apr 5, 2019
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