Skip to content

Conversation

gramalingam
Copy link
Collaborator

Add Erf-based Gelu fusion rule

Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Copy link

codecov bot commented Aug 16, 2025

❌ 9 Tests Failed:

Tests completed Failed Passed Skipped
15961 9 15952 2891
View the top 2 failed test(s) by shortest run time
onnxscript.backend.onnx_export_test.TestOnnxBackEnd::test_export2python_produces_correct_onnx_script_model_0667_test_less_equal
Stack Traces | 0.004s run time
onnxscript\backend\onnx_export_test.py:132: in extract_functions
    mod = importlib.import_module(import_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   ModuleNotFoundError: No module named 'tests.onnx_backend_test_code.test_less_equal'

The above exception was the direct cause of the following exception:
.nox\test_torch_nightly\Lib\site-packages\parameterized\parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\backend\onnx_export_test.py:266: in test_export2python_produces_correct_onnx_script_model
    functions = extract_functions(backend_test.name, code, self.test_folder)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\backend\onnx_export_test.py:134: in extract_functions
    raise AssertionError(
E   AssertionError: Unable to import 'tests.onnx_backend_test_code.test_less_equal' (e=No module named 'tests.onnx_backend_test_code.test_less_equal') (file: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_less_equal.py', absolute path: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_less_equal.py', current folder: D:\a\onnxscript\onnxscript
E   ---- CONTENT --
E   import numpy as np
E   from onnx import TensorProto
E   from onnx.helper import make_tensor
E   from onnxscript import script, external_tensor
E   from onnxscript.values import Opset
E   from onnxscript.onnx_types import BOOL, FLOAT
E   from onnxscript.onnx_opset import opset16
E   
E   @script()
E   def bck_test_less_equal(x: FLOAT[3,4,5], y: FLOAT[3,4,5]) -> (BOOL[3,4,5]):
E       less_equal = opset16.LessOrEqual(x, y)
E       return less_equal
onnxscript.backend.onnx_export_test.TestOnnxBackEnd::test_export2python_produces_correct_onnx_script_model_0409_test_cumsum_2d_axis_1
Stack Traces | 0.005s run time
onnxscript\backend\onnx_export_test.py:132: in extract_functions
    mod = importlib.import_module(import_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   ModuleNotFoundError: No module named 'tests.onnx_backend_test_code.test_cumsum_2d_axis_1'

The above exception was the direct cause of the following exception:
.nox\test_torch_nightly\Lib\site-packages\parameterized\parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\backend\onnx_export_test.py:266: in test_export2python_produces_correct_onnx_script_model
    functions = extract_functions(backend_test.name, code, self.test_folder)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\backend\onnx_export_test.py:134: in extract_functions
    raise AssertionError(
E   AssertionError: Unable to import 'tests.onnx_backend_test_code.test_cumsum_2d_axis_1' (e=No module named 'tests.onnx_backend_test_code.test_cumsum_2d_axis_1') (file: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_cumsum_2d_axis_1.py', absolute path: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_cumsum_2d_axis_1.py', current folder: D:\a\onnxscript\onnxscript
E   ---- CONTENT --
E   import numpy as np
E   from onnx import TensorProto
E   from onnx.helper import make_tensor
E   from onnxscript import script, external_tensor
E   from onnxscript.values import Opset
E   from onnxscript.onnx_types import DOUBLE, INT32
E   from onnxscript.onnx_opset import opset14
E   
E   @script()
E   def bck_test_cumsum_2d_axis_1(x: DOUBLE[2,3], axis: INT32) -> (DOUBLE[2,3]):
E       y = opset14.CumSum(x, axis)
E       return y
View the full list of 1 ❄️ flaky tests
onnxscript.rewriter.ort_fusions.shape_optimization_test.ShapeOptimizationTest::test_shape_optimization_5

Flake rate in main: 50.00% (Passed 6 times, Failed 6 times)

Stack Traces | 0.008s run time
..../test_onnx_ir_git/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../rewriter/ort_fusions/shape_optimization_test.py:58: in test_shape_optimization
    count = shape_optimization.rules.apply_to_model(model)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/rewriter/_rewrite_rule.py:768: in apply_to_model
    count = self._apply_to_graph_or_function(
onnxscript/rewriter/_rewrite_rule.py:659: in _apply_to_graph_or_function
    delta = rule.try_rewrite(
onnxscript/rewriter/_rewrite_rule.py:323: in try_rewrite
    replacement_subgraph = self._replacement_pattern.get_replacement(match)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/rewriter/_rewrite_rule.py:219: in get_replacement
    new_outputs = self._function(context, **match.bindings)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../rewriter/ort_fusions/shape_optimization.py:58: in rewrite
    return op.Constant(value_ints=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/ir/_tape.py:23: in <lambda>
    return lambda *args, **kwargs: self._make_node(op_type, args, kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript/ir/_tape.py:36: in _make_node
    value = super().op(
..../test_onnx_ir_git/lib/python3.11.../site-packages/onnx_ir/_tape.py:92: in op
    attrs = _convenience.convert_attributes(attributes)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/_convenience/__init__.py:270: in convert_attributes
    attributes.append(convert_attribute(name, attr))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/_convenience/__init__.py:148: in convert_attribute
    attr_type = _infer_attribute_type(attr)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/_convenience/__init__.py:73: in _infer_attribute_type
    raise ValueError(
E   ValueError: Cannot infer type of empty sequence. Please create an Attr with an explicit type.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
@gramalingam gramalingam merged commit 3af04e9 into main Aug 20, 2025
23 of 32 checks passed
@gramalingam gramalingam deleted the rama/erfgelu branch August 20, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants