Skip to content

Commit

Permalink
Use NullStringAttr insead of "none" string
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Lassen <[email protected]>
  • Loading branch information
philass committed Sep 27, 2022
1 parent 34539b3 commit 2fac046
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/Transform/ONNX/Decompose.td
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ def GetNullIntegerAttr : NativeCodeCall<"IntegerAttr()">;

def GetNullStringAttr : NativeCodeCall<"StringAttr()">;

def GetNoneStringAttr : NativeCodeCall<"$_builder.getStringAttr(\"none\")">;

// Create a unit constant that will be used as none input.
def CreateUnitConstant
: NativeCodeCall<"::onnx_mlir::createUnitConstant($_builder, $_loc)">;
Expand Down Expand Up @@ -347,7 +345,7 @@ def ClipV12Pattern : Pat<
// Express Scatter (deprecated) using ScatterElements.
def ScatterPattern : Pat<
(ONNXScatterOp $data, $indices, $updates, $axis),
(ONNXScatterElementsOp $data, $indices, $updates, $axis, (GetNoneStringAttr))
(ONNXScatterElementsOp $data, $indices, $updates, $axis, (GetNullStringAttr))
>;

#endif // ONNX_DECOMPOSE
2 changes: 1 addition & 1 deletion test/mlir/onnx/onnx_decompose.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func.func @test_scatter(%arg0: tensor<64x25600xf32>, %arg1: tensor<64x100xi64>,

// CHECK-LABEL: func @test_scatter
// CHECK-SAME: ([[PARAM_0:%.+]]: tensor<64x25600xf32>, [[PARAM_1:%.+]]: tensor<64x100xi64>, [[PARAM_2:%.+]]: tensor<64x100xf32>) -> tensor<*xf32> {
// CHECK-NEXT: [[RES:%.+]] = "onnx.ScatterElements"(%arg0, %arg1, %arg2) {axis = 1 : si64, reduction = "none"} : (tensor<64x25600xf32>, tensor<64x100xi64>, tensor<64x100xf32>) -> tensor<*xf32>
// CHECK-NEXT: [[RES:%.+]] = "onnx.ScatterElements"(%arg0, %arg1, %arg2) {axis = 1 : si64} : (tensor<64x25600xf32>, tensor<64x100xi64>, tensor<64x100xf32>) -> tensor<*xf32>
// CHECK-NEXT: return [[RES]] : tensor<*xf32>
}

0 comments on commit 2fac046

Please sign in to comment.