From 6eb6adff2f1a2fe988e79c53e622b18f9ff7ab26 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 2 Feb 2024 17:22:54 +0100 Subject: [PATCH 1/7] update requirements --- azure-pipelines.yml | 4 ++-- requirements-dev.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 907bb9f..61587f4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,8 +4,8 @@ jobs: vmImage: 'ubuntu-latest' strategy: matrix: - Python311-Linux: - python.version: '3.11' + Python312-Linux: + python.version: '3.12' maxParallel: 3 steps: diff --git a/requirements-dev.txt b/requirements-dev.txt index 5804529..5e262e3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -11,7 +11,7 @@ lightgbm matplotlib ml-dtypes git+https://github.com/onnx/onnxmltools.git -onnxruntime>=1.16.1 +onnxruntime>=1.17.0 openpyxl packaging pandas From 1feac721b484188e18a03e2287ea945f57862422 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 1 Mar 2024 14:48:10 +0100 Subject: [PATCH 2/7] fix names in to_dot --- _doc/api/plotting.rst | 2 ++ onnx_array_api/plotting/dot_plot.py | 7 ++++++- onnx_array_api/plotting/graphviz_helper.py | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/_doc/api/plotting.rst b/_doc/api/plotting.rst index 830cc86..db6076c 100644 --- a/_doc/api/plotting.rst +++ b/_doc/api/plotting.rst @@ -6,6 +6,8 @@ Dot .. autofunction:: onnx_array_api.plotting.dot_plot.to_dot +.. autofunction:: onnx_array_api.plotting.graphviz_helper.plot_dot + Statistics ++++++++++ diff --git a/onnx_array_api/plotting/dot_plot.py b/onnx_array_api/plotting/dot_plot.py index cff93f5..5bfba5d 100644 --- a/onnx_array_api/plotting/dot_plot.py +++ b/onnx_array_api/plotting/dot_plot.py @@ -116,7 +116,12 @@ def myloss(x, y): clean_label_reg2 = re.compile("\\\\p\\{[0-9P]{1,6}\\}") def dot_name(text): - return text.replace("/", "_").replace(":", "__").replace(".", "_") + return ( + text.replace("/", "_") + .replace(":", "__") + .replace(".", "_") + .replace("-", "_") + ) def dot_label(text): if text is None: diff --git a/onnx_array_api/plotting/graphviz_helper.py b/onnx_array_api/plotting/graphviz_helper.py index 2dd93c2..2b098d2 100644 --- a/onnx_array_api/plotting/graphviz_helper.py +++ b/onnx_array_api/plotting/graphviz_helper.py @@ -73,7 +73,7 @@ def _run_subprocess( shell=False, env=os.environ, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, + stderr=subprocess.PIPE, ) raise_exception = False output = "" @@ -91,12 +91,14 @@ def _run_subprocess( ): raise_exception = True p.poll() + error = p.stderr.readline().decode(errors="ignore") p.stdout.close() - if raise_exception: + if error and raise_exception: raise RuntimeError( - "An error was found in the output. The build is stopped.\n{output}" + f"An error was found in the output. The build is stopped." + f"\n{output}\n---\n{error}" ) - return output + return output + "\n" + error def _run_graphviz(filename: str, image: str, engine: str = "dot") -> str: @@ -134,8 +136,12 @@ def _run_graphviz(filename: str, image: str, engine: str = "dot") -> str: exe = engine if os.path.exists(image): os.remove(image) - output = _run_subprocess([exe, f"-T{ext[1:]}", filename, "-o", image]) - assert os.path.exists(image), f"Graphviz failed due to {output}" + cmd = [exe, f"-T{ext[1:]}", filename, "-o", image] + output = _run_subprocess(cmd) + assert os.path.exists(image), ( + f"Unable to find {image!r}, command line is " + f"{' '.join(cmd)!r}, Graphviz failed due to\n{output}" + ) return output From 31304b171b9f1421440c61c63dea16535b0f403b Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 1 Mar 2024 15:12:31 +0100 Subject: [PATCH 3/7] doc --- _doc/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/_doc/conf.py b/_doc/conf.py index 30356d1..3c7a1ad 100644 --- a/_doc/conf.py +++ b/_doc/conf.py @@ -117,6 +117,7 @@ "ast": "https://docs.python.org/3/library/ast.html", "cProfile.Profile": "https://docs.python.org/3/library/profile.html#profile.Profile", "DOT": "https://graphviz.org/doc/info/lang.html", + "Graphviz": "https://graphviz.org/", "inner API": "https://onnx.ai/onnx/intro/python.html", "JIT": "https://en.wikipedia.org/wiki/Just-in-time_compilation", "onnx": "https://onnx.ai/onnx/", From 64cdc471cea10a419226b40cc31009df0375895d Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 1 Mar 2024 15:40:37 +0100 Subject: [PATCH 4/7] fix doc --- _doc/tutorial/onnx_api.rst | 6 +++++- onnx_array_api/plotting/graphviz_helper.py | 4 +++- onnx_array_api/reference/evaluator_yield.py | 2 +- onnx_array_api/validation/docs.py | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/_doc/tutorial/onnx_api.rst b/_doc/tutorial/onnx_api.rst index a4f80be..2b673fb 100644 --- a/_doc/tutorial/onnx_api.rst +++ b/_doc/tutorial/onnx_api.rst @@ -71,7 +71,11 @@ the true implementation would be the following. n2 = oh.make_node("Pow", ["dxy", "two"], ["dxy2"]) n3 = oh.make_node("ReduceSum", ["dxy2"], [output_name]) graph = oh.make_graph([n1, n2, n3], "euclidian", [X, Y], [Z], [two]) - model = oh.make_model(graph, opset_imports=[oh.make_opsetid("", opset)]) + model = oh.make_model( + graph, + opset_imports=[oh.make_opsetid("", opset)], + ir_version=9, + ) return model diff --git a/onnx_array_api/plotting/graphviz_helper.py b/onnx_array_api/plotting/graphviz_helper.py index 2b098d2..8ed0732 100644 --- a/onnx_array_api/plotting/graphviz_helper.py +++ b/onnx_array_api/plotting/graphviz_helper.py @@ -203,6 +203,7 @@ def plot_dot( import matplotlib.pyplot as plt import onnx.parser + from onnx_array_api.plotting.graphviz_helper import plot_dot model = onnx.parser.parse_model( ''' @@ -212,7 +213,8 @@ def plot_dot( four = Add(two, two) z = Mul(four, four) }''') - ax = plot_dot(dot) + + ax = plot_dot(model) ax.set_title("Dummy graph") plt.show() """ diff --git a/onnx_array_api/reference/evaluator_yield.py b/onnx_array_api/reference/evaluator_yield.py index f9f587f..3af4ae8 100644 --- a/onnx_array_api/reference/evaluator_yield.py +++ b/onnx_array_api/reference/evaluator_yield.py @@ -240,7 +240,7 @@ def enumerate_summarized( :param feed_inputs: dictionary `{ input name: input value }` :param raise_exc: raises an exception if the execution fails or stop where it is - :param keep_tensor:keep the tensor in order to compute precise distances + :param keep_tensor: keep the tensor in order to compute precise distances :return: iterator on ResultExecution """ for kind, name, value, op_type in self.enumerate_results( diff --git a/onnx_array_api/validation/docs.py b/onnx_array_api/validation/docs.py index d1a8422..c5f937f 100644 --- a/onnx_array_api/validation/docs.py +++ b/onnx_array_api/validation/docs.py @@ -30,7 +30,9 @@ def make_euclidean( n2 = oh.make_node("Pow", ["dxy", "two"], ["dxy2"]) n3 = oh.make_node("ReduceSum", ["dxy2"], [output_name]) graph = oh.make_graph([n1, n2, n3], "euclidian", [X, Y], [Z], [two]) - model = oh.make_model(graph, opset_imports=[oh.make_opsetid("", opset)]) + model = oh.make_model( + graph, opset_imports=[oh.make_opsetid("", opset)], ir_version=9 + ) return model From 3d35f3f0c106bc6852c827ad57619f4673f92ba1 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 1 Mar 2024 15:55:45 +0100 Subject: [PATCH 5/7] doc --- onnx_array_api/reference/evaluator_yield.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/onnx_array_api/reference/evaluator_yield.py b/onnx_array_api/reference/evaluator_yield.py index 3af4ae8..73a196e 100644 --- a/onnx_array_api/reference/evaluator_yield.py +++ b/onnx_array_api/reference/evaluator_yield.py @@ -238,8 +238,7 @@ def enumerate_summarized( :param output_names: requested outputs by names, None for all :param feed_inputs: dictionary `{ input name: input value }` - :param raise_exc: raises an exception if the execution fails or stop - where it is + :param raise_exc: raises an exception if the execution fails or stop where it is :param keep_tensor: keep the tensor in order to compute precise distances :return: iterator on ResultExecution """ From 05bb8e43a415dd9048905511fa0313f3b6ba8b71 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 1 Mar 2024 16:06:24 +0100 Subject: [PATCH 6/7] fix doc --- onnx_array_api/plotting/graphviz_helper.py | 15 ++++++++------- onnx_array_api/reference/evaluator_yield.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/onnx_array_api/plotting/graphviz_helper.py b/onnx_array_api/plotting/graphviz_helper.py index 8ed0732..5fb3f32 100644 --- a/onnx_array_api/plotting/graphviz_helper.py +++ b/onnx_array_api/plotting/graphviz_helper.py @@ -206,13 +206,14 @@ def plot_dot( from onnx_array_api.plotting.graphviz_helper import plot_dot model = onnx.parser.parse_model( - ''' - - agraph (float[N] x) => (float[N] z) { - two = Constant () - four = Add(two, two) - z = Mul(four, four) - }''') + ''' + + agraph (float[N] x) => (float[N] z) { + two = Constant () + four = Add(two, two) + z = Mul(four, four) + } + ''') ax = plot_dot(model) ax.set_title("Dummy graph") diff --git a/onnx_array_api/reference/evaluator_yield.py b/onnx_array_api/reference/evaluator_yield.py index 73a196e..88c8a1f 100644 --- a/onnx_array_api/reference/evaluator_yield.py +++ b/onnx_array_api/reference/evaluator_yield.py @@ -237,7 +237,7 @@ def enumerate_summarized( Executes the onnx model and enumerate intermediate results without their names. :param output_names: requested outputs by names, None for all - :param feed_inputs: dictionary `{ input name: input value }` + :param feed_inputs: dictionary ``{ input name: input value }`` :param raise_exc: raises an exception if the execution fails or stop where it is :param keep_tensor: keep the tensor in order to compute precise distances :return: iterator on ResultExecution From 972ce33ae5359e5b8b9541e2e86b1837236089a9 Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Fri, 1 Mar 2024 16:09:52 +0100 Subject: [PATCH 7/7] doc --- onnx_array_api/plotting/graphviz_helper.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/onnx_array_api/plotting/graphviz_helper.py b/onnx_array_api/plotting/graphviz_helper.py index 5fb3f32..4aec5e4 100644 --- a/onnx_array_api/plotting/graphviz_helper.py +++ b/onnx_array_api/plotting/graphviz_helper.py @@ -196,8 +196,7 @@ def plot_dot( :param image: output image, None, just returns the output :param engine: *dot* or *neato* :param figsize: figsize of ax is None - :return: :epkg:`Graphviz` output or - the dot text if *image* is None + :return: :epkg:`Graphviz` output or, the dot text if *image* is None .. plot:: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy