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
[feature request] Treat tensor as tuple of tensors in torch.cat #10182
Comments
I'm not sure I understand the reason for the request. |
In my particular case, I'm creating a graph neural network. Let In other words, a tensor should be treated as a tensor of tensors when a sequence is expected. |
|
@ssnl That works, though it's less concise. Shouldn't it be possible to treat a tensor like a sequence? Even better would be adding |
I think the request of making We already consider a tensor as an iterable (we can do I'd not vote for adding |
A simple fix for this issue would be to do something like def cat(tensors, dim=0)
return torch.cat(tuple(tensors), dim=dim) (or using |
Some of the core devs discussed this today. We dont think this feature request will go in. Here is the reasoning:
|
Issue description
Treat
torch.cat(a)
astorch.cat(tuple(a))
whena
is a tensor, like numpy does.Code example
outputs
The text was updated successfully, but these errors were encountered: