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

Contatenating AugmentedTensor does not work when giving a tuple to torch.cat #306

Open
jsalotti opened this issue Nov 21, 2022 · 0 comments · Fixed by #307
Open

Contatenating AugmentedTensor does not work when giving a tuple to torch.cat #306

jsalotti opened this issue Nov 21, 2022 · 0 comments · Fixed by #307
Assignees
Labels
bug Something isn't working

Comments

@jsalotti
Copy link
Contributor

In aloception-oss, we have overloaded some operation of torch.tensor. For example, a mechanism allows torch.cat to concatenate multiple AugmentedTensor and theirs children, in a recursive manner.

But in the current state of the code: torch.cat works as expected with a List of AugmentedTensor as input, but not with a tuple of AugmentedTensor.

from aloscene import Frame
from aloscene.tensors import AugmentedTensor

x = Frame(torch.rand(3, 10, 10), names=('C', 'H', 'W'))
x.add_child('mychild',AugmentedTensor(torch.rand(2), names=("N",)) , mergeable=True, align_dim=["B", "T"])
y = Frame(torch.rand(3, 10, 10), names=('C', 'H', 'W'))
y.add_child('mychild',AugmentedTensor(torch.rand(2), names=("N",)) , mergeable=True, align_dim=["B", "T"])
result = torch.cat((x.batch(), y.batch()), dim=0)
print(result.mychild.names, " - ", result.mychild.shape)

Expected output:

('B', 'N')  -  torch.Size([2, 2])

Current output:

('B', 'N')  -  torch.Size([1, 2])
@jsalotti jsalotti added the bug Something isn't working label Nov 21, 2022
@jsalotti jsalotti self-assigned this Nov 21, 2022
@Data-Iab Data-Iab linked a pull request Nov 21, 2022 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant