You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug einops.layers.torch.Rearrange and einops.rearrange behave differently with list[torch.Tensor].
It is possible to use rearrange for concatenation, while Rearrange fails with error:
einops/_torch_specific.py:66, in TorchJitBackend.shape(x)
64 @staticmethod
65 def shape(x):
---> 66 return x.shape
AttributeError: 'list' object has no attribute 'shape'
Reproduction steps
importtorchfromeinopsimportrearrangefromeinops.layers.torchimportRearrangelayer=Rearrange('num b c h w -> b (num c) h w', num=2)
func=lambdax: rearrange(x, 'num b c h w -> b (num c) h w', num=2)
t1=torch.randn((1, 3, 16, 24))
t2=torch.rand((1, 3, 16, 24))
y=func([w1, w2]) # OKy=layer([w1, w2]) # AttributeError: 'list' object has no attribute 'shape'
Expected behavior
Expect the same behavior in both cases (hopefully correct operation execution, not raise exception)
Your platform
python==3.10.12
torch==2.0.1
einops==0.6.1
The text was updated successfully, but these errors were encountered:
arogozhnikov
changed the title
[BUG] einops.layers.torch.Rearrange and einops.rearrange behave differently with list[torch.Tensor]
einops.layers.torch.Rearrange does not accept a list[torch.Tensor] as an input
Sep 19, 2023
Describe the bug
einops.layers.torch.Rearrange
andeinops.rearrange
behave differently withlist[torch.Tensor]
.It is possible to use
rearrange
for concatenation, whileRearrange
fails with error:Reproduction steps
Expected behavior
Expect the same behavior in both cases (hopefully correct operation execution, not raise exception)
Your platform
python==3.10.12
torch==2.0.1
einops==0.6.1
The text was updated successfully, but these errors were encountered: