Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/Dialect/Torch/Transforms/DecomposeComplexOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12855,8 +12855,7 @@ class DecomposeAtenAsStridedOp : public OpRewritePattern<AtenAsStridedOp> {
Value index = rewriter.create<Torch::AtenArangeOp>(
loc, arangeType, end, cstNone, cstNone, cstNone, cstNone);

// Set the current dimension to -1 for broadcasting
viewShapeInts[dim] = -1;
viewShapeInts[dim] = size;
viewShapeListElems[dim] = cstMinusOne;

Value viewShapeList = rewriter.create<Torch::PrimListConstructOp>(
Expand Down
16 changes: 16 additions & 0 deletions test/Dialect/Torch/decompose-complex-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -934,3 +934,19 @@ func.func @channel_shuffle(%arg0: !torch.vtensor<[1,8,4,4],f32>) -> !torch.vtens
%0 = torch.aten.channel_shuffle %arg0, %int4 : !torch.vtensor<[1,8,4,4],f32>, !torch.int -> !torch.vtensor<[1,8,4,4],f32>
return %0 : !torch.vtensor<[1,8,4,4],f32>
}

// -----

// CHECK-LABEL: func.func @torch.aten.as_strided$static_shapes
func.func @torch.aten.as_strided$static_shapes(%arg0: !torch.vtensor<[4,8],f32>) -> !torch.vtensor<[2,3],f32> {
%int0 = torch.constant.int 0
%int2 = torch.constant.int 2
%int3 = torch.constant.int 3
%int1 = torch.constant.int 1
%size = torch.prim.ListConstruct %int2, %int3 : (!torch.int, !torch.int) -> !torch.list<int>
%stride = torch.prim.ListConstruct %int1, %int1 : (!torch.int, !torch.int) -> !torch.list<int>
// CHECK: torch.aten.view {{.*}} -> !torch.vtensor<[2,1],si64>
// CHECK: torch.aten.view {{.*}} -> !torch.vtensor<[1,3],si64>
%0 = torch.aten.as_strided %arg0, %size, %stride, %int0 : !torch.vtensor<[4,8],f32>, !torch.list<int>, !torch.list<int>, !torch.int -> !torch.vtensor<[2,3],f32>
return %0 : !torch.vtensor<[2,3],f32>
}
Loading