From 86e112ed82a99a6ebbe3ffc2321bef67aca1699d Mon Sep 17 00:00:00 2001 From: Seungho Henry Park Date: Thu, 12 Feb 2026 17:58:46 +0900 Subject: [PATCH] [circle-mlir/models] Introduce test models for Range op This introduces test models for the Range operation. The tests will be activated once support for the Range pass is completed. Signed-off-by: Seungho Henry Park --- .../tools-test/circle-impexp-test/test.lst | 3 +++ .../tools-test/onnx2circle-models/test.lst | 4 ++++ .../onnx2circle-value-test/test.lst | 3 +++ .../models/unit/Range_F32_R0_1/__init__.py | 20 +++++++++++++++++++ .../models/unit/Range_F32_R0_2/__init__.py | 19 ++++++++++++++++++ .../models/unit/Range_F32_R0_3/__init__.py | 20 +++++++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 circle-mlir/models/unit/Range_F32_R0_1/__init__.py create mode 100644 circle-mlir/models/unit/Range_F32_R0_2/__init__.py create mode 100644 circle-mlir/models/unit/Range_F32_R0_3/__init__.py diff --git a/circle-mlir/circle-mlir/tools-test/circle-impexp-test/test.lst b/circle-mlir/circle-mlir/tools-test/circle-impexp-test/test.lst index e37456c4e97..c8e6ee480bb 100644 --- a/circle-mlir/circle-mlir/tools-test/circle-impexp-test/test.lst +++ b/circle-mlir/circle-mlir/tools-test/circle-impexp-test/test.lst @@ -129,6 +129,9 @@ AddModel(Pow_F32_R2) AddModel(Pow_F32_R2_3) AddModel(Pow_F32_R4) AddModel(PReLU_F32_R4) +# AddModel(Range_F32_R0_1) --> Does't support dynamic shape output +# AddModel(Range_F32_R0_2) --> Does't support dynamic shape output +# AddModel(Range_F32_R0_3) --> Does't support dynamic shape output AddModel(Reciprocal_F32_R4) AddModel(ReduceMax_F32_R2) AddModel(ReduceMax_F32_R2_d0) diff --git a/circle-mlir/circle-mlir/tools-test/onnx2circle-models/test.lst b/circle-mlir/circle-mlir/tools-test/onnx2circle-models/test.lst index 6f48bb927ad..eb6e8580267 100644 --- a/circle-mlir/circle-mlir/tools-test/onnx2circle-models/test.lst +++ b/circle-mlir/circle-mlir/tools-test/onnx2circle-models/test.lst @@ -137,6 +137,10 @@ AddModel(QuantizeLinear_F32_R3_ui8) AddModel(QuantizeLinear_F32_R3_ui8_fq) AddModel(QuantizeLinear_F32_R4_i16_cw) AddModel(QuantizeLinear_F32_R4_ui8_cw) +# TODO activate after Range op support +# AddModel(Range_F32_R0_1) +# AddModel(Range_F32_R0_2) +# AddModel(Range_F32_R0_3) AddModel(Reciprocal_F32_R4) AddModel(ReduceMax_F32_R2) AddModel(ReduceMax_F32_R2_d0) diff --git a/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/test.lst b/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/test.lst index 87c1aa9171b..d7e2f8551d1 100644 --- a/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/test.lst +++ b/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/test.lst @@ -137,6 +137,9 @@ AddModel(PReLU_F32_R4) # AddModel(QuantizeLinear_F32_R3_ui8_fq) # AddModel(QuantizeLinear_F32_R4_i16_cw) # AddModel(QuantizeLinear_F32_R4_ui8_cw) +# AddModel(Range_F32_R0_1) --> Does't support dynamic shape output +# AddModel(Range_F32_R0_2) --> Does't support dynamic shape output +# AddModel(Range_F32_R0_3) --> Does't support dynamic shape output AddModel(Reciprocal_F32_R4) AddModel(ReduceMax_F32_R2) AddModel(ReduceMax_F32_R2_d0) diff --git a/circle-mlir/models/unit/Range_F32_R0_1/__init__.py b/circle-mlir/models/unit/Range_F32_R0_1/__init__.py new file mode 100644 index 00000000000..fe14b3c8f96 --- /dev/null +++ b/circle-mlir/models/unit/Range_F32_R0_1/__init__.py @@ -0,0 +1,20 @@ +import torch + + +# Generate Range operator with Float32, scalar +class net_Range(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward(self, input): + limit = input + return torch.arange(0, limit, 1, dtype=torch.float32) + + def onnx_opset_version(self): + return 11 + + +_model_ = net_Range() + +# produce float32 scalar with fixed number +_inputs_ = torch.tensor(10, dtype=torch.float32) diff --git a/circle-mlir/models/unit/Range_F32_R0_2/__init__.py b/circle-mlir/models/unit/Range_F32_R0_2/__init__.py new file mode 100644 index 00000000000..00a3ea63f31 --- /dev/null +++ b/circle-mlir/models/unit/Range_F32_R0_2/__init__.py @@ -0,0 +1,19 @@ +import torch + + +# Generate Range operator with Float32, scalar +class net_Range(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward(self, limit, delta): + return torch.arange(0, limit, delta, dtype=torch.float32) + + def onnx_opset_version(self): + return 11 + + +_model_ = net_Range() + +# produce float32 scalar with fixed number +_inputs_ = (torch.tensor(10, dtype=torch.float32), torch.tensor(1, dtype=torch.float32)) diff --git a/circle-mlir/models/unit/Range_F32_R0_3/__init__.py b/circle-mlir/models/unit/Range_F32_R0_3/__init__.py new file mode 100644 index 00000000000..27aceaffb70 --- /dev/null +++ b/circle-mlir/models/unit/Range_F32_R0_3/__init__.py @@ -0,0 +1,20 @@ +import torch + + +# Generate Range operator with Float32, scalar +class net_Range(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward(self, start, limit, delta): + return torch.arange(start, limit, delta, dtype=torch.float32) + + def onnx_opset_version(self): + return 11 + + +_model_ = net_Range() + +# produce float32 scalar with fixed number +_inputs_ = (torch.tensor(0, dtype=torch.float32), torch.tensor(10, dtype=torch.float32), + torch.tensor(1, dtype=torch.float32))