Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed cat uint8 lowering (pytorch#112753)
Description: - Fixed cat uint8 lowering Otherwise, it gives the following issue on the repro code: ```python def func(x): batch_shape = x.shape[:1] out = torch.cat([x.new_zeros(1).expand(batch_shape + (1,)), x], dim=-1) return out cfunc = torch.compile(func) x = torch.randint(0, 256, size=(3, 255), dtype=torch.uint8) out = cfunc(x) ``` Error message: ``` File "/pytorch/torch/_inductor/lowering.py", line 1037, in <genexpr> if all(len(input.layout.size) == 4 for input in inputs): File "/pytorch/torch/_inductor/ir.py", line 5795, in __getattr__ fn = getattr(self.data, name) torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised: LoweringException: AttributeError: 'ExpandView' object has no attribute 'layout' target: aten.cat.default args[0]: [TensorBox( ExpandView(data=StorageBox( ComputedBuffer(name='buf0', layout=FlexibleLayout('cpu', torch.uint8, size=[1], stride=[1]), data=Pointwise( 'cpu', torch.uint8, def inner_fn(index): _ = index tmp0 = ops.constant(0, torch.uint8) return tmp0 , ranges=[1], origin_node=full, origins={full} )) ), size=[3, 1]) ), TensorBox(StorageBox( InputBuffer(name='arg0_1', layout=FixedLayout('cpu', torch.uint8, size=[3, 255], stride=[255, 1])) ))] args[1]: 1 Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information ``` Context: compiling is not working for torchvision's `F.equalize` op: pytorch/vision#8056 Pull Request resolved: pytorch#112753 Approved by: https://github.com/peterbell10
- Loading branch information