Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adds tools to compare models#11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sdpython merged 2 commits intomainfromdiff
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
update path
  • Loading branch information
@xadupre
xadupre committedApr 24, 2023
commit1798e3894bc6b494734d899d93262cc2179f6472
6 changes: 4 additions & 2 deletions.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,5 +15,7 @@ _doc/examples/plot_*.png
_doc/_static/require.js
_doc/_static/viz.js
_unittests/ut__main/*.png
_doc/examples/data/small.onnx.optimized.onnx
_doc/examples/diff_html.html
_doc/examples/data/*.optimized.onnx
_doc/examples/*.html
_unittests/ut__main/_cache/*
_unittests/ut__main/*.html
7 changes: 5 additions & 2 deletions_doc/api/tools.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,11 @@ Benchmark

.. autofunction:: onnx_array_api.ext_test_case.measure_time

Examples
++++++++

.. autofunction:: onnx_array_api.ext_test_case.example_path

Profiling
+++++++++

Expand All@@ -25,5 +30,3 @@ Unit tests

.. autoclass:: onnx_array_api.ext_test_case.ExtTestCase
:members:


3 changes: 2 additions & 1 deletion_doc/examples/plot_optimization.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,14 +15,15 @@
from pandas import DataFrame
import matplotlib.pyplot as plt
from onnx import load
from onnx_array_api.ext_test_case import example_path
from onnx_array_api.plotting.text_plot import onnx_simple_text_plot
from onnx_array_api.validation.diff import text_diff, html_diff
from onnxruntime import GraphOptimizationLevel, InferenceSession, SessionOptions
from onnx_array_api.ext_test_case import measure_time
from onnx_array_api.ort.ort_optimizers import ort_optimized_model


filename = "data/small.onnx"
filename =example_path("data/small.onnx")
optimized = filename + ".optimized.onnx"

if not os.path.exists(optimized):
Expand Down
14 changes: 14 additions & 0 deletionsonnx_array_api/ext_test_case.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,20 @@ def call_f(self):
return wrapper


def example_path(path: str) -> str:
"""
Fixes a path for the examples.
Helps running the example within a unit test.
"""
if os.path.exists(path):
return path
this = os.path.abspath(os.path.dirname(__file__))
full = os.path.join(this, "..", "_doc", "examples", path)
if os.path.exists(full):
return full
raise FileNotFoundError(f"Unable to find path {path!r} or {full!r}.")


def measure_time(
stmt: Callable,
context: Optional[Dict[str, Any]] = None,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp