Skip to content

Replace input-constraint asserts with TranslationError in converter#2845

Merged
gramalingam merged 1 commit intomainfrom
rama/cleanup
Mar 10, 2026
Merged

Replace input-constraint asserts with TranslationError in converter#2845
gramalingam merged 1 commit intomainfrom
rama/cleanup

Conversation

@gramalingam
Copy link
Collaborator

Replace 5 assert statements that check input AST constraints with TranslationError (via self._fail()) to provide meaningful error messages instead of bare AssertionErrors:

  • Compare expressions: require single comparison operator
  • Return statements: require a return value
  • For loop bounds: require a function call, no keyword arguments

Replace 5 assert statements that check input AST constraints with
TranslationError (via self._fail()) to provide meaningful error messages
instead of bare AssertionErrors:

- Compare expressions: require single comparison operator
- Return statements: require a return value
- For loop bounds: require a function call, no keyword arguments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 9, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
13074 1 13073 2257
View the top 1 failed test(s) by shortest run time
onnxscript.rewriter.ort_fusions.cos_sin_cache_test.TestCosSinCacheTransform::test_cos_sin_fusion_0_smollm_test_1
Stack Traces | 12.3s run time
.nox\test_onnx_ir_git\Lib\site-packages\parameterized\parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\rewriter\ort_fusions\cos_sin_cache_test.py:50: in test_cos_sin_fusion
    new_outputs = ort_run("optimized", model, inputs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxscript\rewriter\ort_fusions\_test_utils.py:19: in ort_run
    model_proto.SerializeToString(), options, providers=providers
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   MemoryError
View the full list of 1 ❄️ flaky test(s)
tests.function_libs.torch_lib.ops_test.TestOutputConsistencyFullGraphCPU::test_output_match_opinfo__logsumexp_cpu_float16

Flake rate in main: 20.00% (Passed 44 times, Failed 11 times)

Stack Traces | 0.173s run time
.../function_libs/torch_lib/ops_test.py:243: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 5 (20.0%)
E   Greatest absolute difference: 2.288818359375e-05 at index (1,) (up to 1e-05 allowed)
E   Greatest relative difference: 0.0022869110107421875 at index (1,) (up to 0.001 allowed)

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

@github-project-automation github-project-automation bot moved this from Todo to Done in ONNX Script Review Board Mar 9, 2026
@gramalingam gramalingam merged commit 65a59e3 into main Mar 10, 2026
27 of 31 checks passed
@gramalingam gramalingam deleted the rama/cleanup branch March 10, 2026 18:43
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