-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add result type inference to RandomNormalLike and fix wrong hardcodin…
…gs for dtypes (#3091) * Add RandomNormalLike to ops with ResultTypeInference Signed-off-by: Rickert, Jonas <[email protected]> * Add type inference for RandomNormalLike op Signed-off-by: Rickert, Jonas <[email protected]> * Fix wrong dtype hardcoding in RandomNormal and RandomNormalLike Also add support for bf16 dtype. Change tests to not contain invalid mlir Signed-off-by: Rickert, Jonas <[email protected]> * Tests for output type inference for RandomNormalLike op Signed-off-by: Rickert, Jonas <[email protected]> --------- Signed-off-by: Rickert, Jonas <[email protected]> Co-authored-by: Sai Kiran Yeddlapalli Ganesh <[email protected]>
- Loading branch information
Showing
11 changed files
with
180 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/mlir/onnx/parse/random_normal_like_dtype_bf16.onnxtext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: onnx-mlir --EmitONNXBasic --useOnnxModelTypes=false --printIR %s | FileCheck %s | ||
|
||
// Test output type inference of RandomNormalLike ignoring the types from the model using --useOnnxModelTypes=false | ||
// Output type should be bf16 as dtype = 16 eventhough the output type specified in model is float32 | ||
|
||
< | ||
ir_version: 4, | ||
opset_import: ["" : 22] | ||
> | ||
test_random_normal_like_dtype (float[unk__a,unk__b] RandomNormalLike_in) => (float[] RandomNormalLike_out) | ||
{ | ||
RandomNormalLike_out = RandomNormalLike<dtype: int = 16, mean: float = 0.0, scale: float = 1.0, seed: float = 2.0> (RandomNormalLike_in) | ||
} | ||
|
||
// CHECK-LABEL: func.func @main_graph( | ||
// CHECK-SAME: %[[VAL_0:.*]]: tensor<?x?xf32> {onnx.dim_params = "0:unk__a,1:unk__b", onnx.name = "RandomNormalLike_in"}) -> (tensor<?x?xbf16> {onnx.name = "RandomNormalLike_out"}) { | ||
// CHECK: %[[VAL_1:.*]] = "onnx.RandomNormalLike"(%[[VAL_0]]) {dtype = 16 : si64, mean = 0.000000e+00 : f32, scale = 1.000000e+00 : f32, seed = 2.000000e+00 : f32} : (tensor<?x?xf32>) -> tensor<?x?xbf16> | ||
// CHECK: onnx.Return %[[VAL_1]] : tensor<?x?xbf16> | ||
// CHECK: } |
Oops, something went wrong.