Special handling for op_cat for 1D empty tensor
Summary: The behavior is a bit different. When we see a 1D empty tensor in the tensor list, just ignore it and treat it as a wildcard, and go to the next one. The dim rules doesn't apply here. From aten: (can use `torch.ops.aten.cat.out` instead of `torch.cat`) ``` >>> torch.cat([torch.ones([0]), torch.ones([0])], dim=-4) tensor([]) >>> torch.cat([torch.ones([0]), torch.ones([0]), torch.ones([1, 1])], dim=0) tensor([[1.]]) >>> torch.cat([torch.ones([0,0,0,0]), torch.ones([0,0,0])], dim=2) Tensors must have same number of dimensions: got 4 and 3 >>> torch.cat([torch.ones([0]), torch.ones([0]), torch.ones([0]), torch.ones([1])], dim=1000) Dimension out of range (expected to be in range of [-1, 0], but got 1000) >>> torch.cat([torch.ones([0]), torch.ones([0,0])], dim=-4) Dimension out of range (expected to be in range of [-2, 1], but got -4) Reviewed By: manuelcandales Differential Revision: D48449555 fbshipit-source-id: 3eb4559b7229cddf78e2c70adacf83969d454643
H
Hansong Zhang committed
78925641eb6ed73fa91f2ecd38b140fd01d54806
Parent: e6deec6
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 8/17/2023, 11:23:20 PM