Skip to content

[rewriter][docs] Add Tutorial for Pattern-based Rewrites #6529

[rewriter][docs] Add Tutorial for Pattern-based Rewrites

[rewriter][docs] Add Tutorial for Pattern-based Rewrites #6529

GitHub Actions / Test Results failed May 2, 2024 in 0s

4 fail, 1 886 skipped, 4 039 pass in 3h 5m 47s

     30 files  ±      0      30 suites  ±0   3h 5m 47s ⏱️ + 2h 12m 48s
  5 929 tests  -   2 186   4 039 ✅  -  1 550    1 886 💤  -     639   4 ❌ + 3 
547 372 runs  +387 130  86 695 ✅ +31 204  460 619 💤 +355 892  58 ❌ +34 

Results for commit 0dbb84d. ± Comparison against earlier commit 8876bb9.

Annotations

Check warning on line 0 in tests.function_libs.torch_lib.ops_test.TestOutputConsistencyEagerCPU

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 29 runs failed: test_output_match_opinfo__native_layer_norm_cpu_float32 (tests.function_libs.torch_lib.ops_test.TestOutputConsistencyEagerCPU)

artifacts/Test Results (py310-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py311-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py311-onnx-weekly-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py311-torch-nightly-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py312-torch-nightly-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py38-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py39-macos-latest)/pytest.xml [took 0s]
Raw output
AssertionError: Output 2 mismatch
AssertionError: Output 2 mismatch
AssertionError: Output 2 mismatch
AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 1.154693603515625 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.0036514615640044212 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 15.526153564453125 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.04909800738096237 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 4.3814697265625 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.013855422846972942 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 3.34576416015625 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.010580234229564667 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch

Check warning on line 0 in tests.functions.gemmgelu_test.TestGemmGelu

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 23 runs failed: test_gemmgelu (tests.functions.gemmgelu_test.TestGemmGelu)

artifacts/Test Results (py311-ort-nightly-macos-latest)/pytest.xml [took 4s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

Mismatched elements: 1 / 16 (6.25%)
Max absolute difference: 2.3841858e-07
Max relative difference: 1.5581162e-07
 x: array([[[1.608876, 1.258398, 1.868434, 1.530172, 1.502594, 1.577003,
         0.930287, 1.438904],
        [2.2129  , 1.367099, 2.42691 , 2.158696, 1.992608, 2.096078,
         1.297177, 2.084625]]], dtype=float32)
 y: array([[[1.608876, 1.258398, 1.868434, 1.530172, 1.502594, 1.577003,
         0.930287, 1.438904],
        [2.2129  , 1.367099, 2.42691 , 2.158696, 1.992608, 2.096078,
         1.297177, 2.084625]]], dtype=float32)
tests/functions/gemmgelu_test.py:62: in test_gemmgelu
    self.run_converter_test(case)
tests/common/onnx_script_test_case.py:255: in run_converter_test
    np.testing.assert_allclose(actual, param.output, rtol=self.rtol)
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:81: in inner
    return func(*args, **kwds)
E   AssertionError: 
E   Not equal to tolerance rtol=1e-07, atol=0
E   
E   Mismatched elements: 1 / 16 (6.25%)
E   Max absolute difference: 2.3841858e-07
E   Max relative difference: 1.5581162e-07
E    x: array([[[1.608876, 1.258398, 1.868434, 1.530172, 1.502594, 1.577003,
E            0.930287, 1.438904],
E           [2.2129  , 1.367099, 2.42691 , 2.158696, 1.992608, 2.096078,
E            1.297177, 2.084625]]], dtype=float32)
E    y: array([[[1.608876, 1.258398, 1.868434, 1.530172, 1.502594, 1.577003,
E            0.930287, 1.438904],
E           [2.2129  , 1.367099, 2.42691 , 2.158696, 1.992608, 2.096078,
E            1.297177, 2.084625]]], dtype=float32)

Check warning on line 0 in tests.function_libs.torch_lib.ops_test.TestOutputConsistencyFullGraphCPU

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 29 runs failed: test_output_match_opinfo__native_layer_norm_cpu_float32 (tests.function_libs.torch_lib.ops_test.TestOutputConsistencyFullGraphCPU)

artifacts/Test Results (py310-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py311-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py311-onnx-weekly-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py311-torch-nightly-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py312-torch-nightly-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py38-macos-latest)/pytest.xml [took 0s]
artifacts/Test Results (py39-macos-latest)/pytest.xml [took 0s]
Raw output
AssertionError: Output 2 mismatch
AssertionError: Output 2 mismatch
AssertionError: Output 2 mismatch
AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 1.154693603515625 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.0036514615640044212 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 15.526153564453125 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.04909800738096237 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 4.3814697265625 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.013855422846972942 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch
tests/function_libs/torch_lib/ops_test.py:279: in run_test_output_match
    torch.testing.assert_close(
E   AssertionError: Tensor-likes are not close!
E   
E   Mismatched elements: 1 / 1 (100.0%)
E   Greatest absolute difference: 3.34576416015625 at index (0,) (up to 0.00018 allowed)
E   Greatest relative difference: 0.010580234229564667 at index (0,) (up to 3.7e-05 allowed)

The above exception was the direct cause of the following exception:
tests/function_libs/torch_lib/ops_test.py:293: in run_test_output_match
    raise AssertionError(f"Output {j} mismatch") from e
E   AssertionError: Output 2 mismatch

Check warning on line 0 in onnxscript.backend.onnx_export_test.TestOnnxBackEnd

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_loop (onnxscript.backend.onnx_export_test.TestOnnxBackEnd) failed

artifacts/Test Results (py312-torch-nightly-windows-latest)/pytest.xml [took 0s]
Raw output
AssertionError: Unable to import 'tests.export.loop1' (file: WindowsPath('D:/a/onnxscript/onnxscript/tests/export/loop1.py'))
----
import numpy
from onnx import TensorProto
from onnx.helper import make_tensor
from onnxscript import script, external_tensor
from onnxscript.values import Opset

from onnxscript.onnx_opset import opset17
this1 = Opset('this', 1)

@script(this1)
def loop1(X, N):
    Sum = opset17.Identity(X)
    Sum_0 = Sum
    for _ in range(N):
        Sum_1 = opset17.Add(Sum_0, X)
        Sum_0 = Sum_1
    Sum_2 = Sum_0
    return Sum_2
onnxscript\backend\onnx_export_test.py:117: in extract_functions
    mod = importlib.import_module(import_name)
C:\hostedtoolcache\windows\Python\3.12.3\x64\Lib\importlib\__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1324: in _find_and_load_unlocked
    ???
E   ModuleNotFoundError: No module named 'tests.export.loop1'

The above exception was the direct cause of the following exception:
onnxscript\backend\onnx_export_test.py:195: in test_loop
    self._round_trip_check(loop1)
onnxscript\backend\onnx_export_test.py:149: in _round_trip_check
    map = extract_functions(proto.name, code, TestOnnxBackEnd.temp_folder)
onnxscript\backend\onnx_export_test.py:119: in extract_functions
    raise AssertionError(
E   AssertionError: Unable to import 'tests.export.loop1' (file: WindowsPath('D:/a/onnxscript/onnxscript/tests/export/loop1.py'))
E   ----
E   import numpy
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   
E   from onnxscript.onnx_opset import opset17
E   this1 = Opset('this', 1)
E   
E   @script(this1)
E   def loop1(X, N):
E       Sum = opset17.Identity(X)
E       Sum_0 = Sum
E       for _ in range(N):
E           Sum_1 = opset17.Add(Sum_0, X)
E           Sum_0 = Sum_1
E       Sum_2 = Sum_0
E       return Sum_2