Error when passing the dim argument to torch.cat()

When I follow the signature for torch.cat described on the docs, and try to pass a dim argument, I get the error

TypeError: cat() takes no keyword arguments

I also noticed that when I do help(torch.cat), the documentation that pops up uses dimension instead of dim as the name of the argument which indicates along which axis to concatenate the tensors.

I understand that the function works by passing the dimension as a non-keyword argument, but then isn’t documenting it with dim=0 misleading?

Well, I also met this error whether I use dim or dimension, if I just ignore them and just pass a number, it can work.

1 Like

@pietromarchesi i believe this was fixed in https://github.com/pytorch/pytorch/issues/1028 to support keyword arguments, and might have gone into 0.1.12 release.