Skip to content

Commit 689cc6f

Browse files
authored
Upgrade version (#94)
* Upgrade version * upgrade version * disable * fix import * disable more * remove mac ci * remove numpy.array_api * remove * one day maybe * fix urls
1 parent eb106e2 commit 689cc6f

File tree

14 files changed

+35
-83
lines changed

14 files changed

+35
-83
lines changed

.github/workflows/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ jobs:
8383
exit 1
8484
fi
8585
86-
- uses: actions/upload-artifact@v3
86+
- uses: actions/upload-artifact@v4
8787
with:
8888
path: ./dist/html/**

.github/workflows/wheels-any.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
- name: build wheel
2525
run: python -m pip wheel .
2626

27-
- uses: actions/upload-artifact@v3
27+
- uses: actions/upload-artifact@v4
2828
with:
2929
path: ./onnx_array_api*.whl

CHANGELOGS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Change Logs
44
0.3.0
55
+++++
66

7+
* :pr:`93`: fixes evaluator type in ``compare_onnx_execution``
78
* :pr:`92`: avoids recursion errors in profiling
89
* :pr:`87`: adds command line to replace contant by ConstantOfShape
910
* :pr:`79`: first draft to export to GraphBuilder

_doc/conf.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,9 @@
146146
"torch.onnx": "https://pytorch.org/docs/stable/onnx.html",
147147
#
148148
"C_OrtValue": (
149-
"http://www.xavierdupre.fr/app/onnxcustom/helpsphinx/"
150-
"api/onnxruntime_python/ortvalue.html#c-class-ortvalue-or-c-ortvalue"
149+
"https://onnxruntime.ai/docs/api/csharp/api/Microsoft.ML.OnnxRuntime.OrtValue.html"
151150
),
152151
"OrtValue": (
153-
"http://www.xavierdupre.fr/app/onnxcustom/helpsphinx/"
154-
"api/onnxruntime_python/ortvalue.html#onnxruntime.OrtValue"
152+
"https://onnxruntime.ai/docs/api/python/api_summary.html#onnxruntime.OrtValue"
155153
),
156154
}

_doc/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,7 @@ to know onnx for that. See :ref:`l-numpy-api-onnx`.
187187
Older versions
188188
++++++++++++++
189189

190+
* `0.3.0 <../v0.3.0/index.html>`_
191+
* `0.2.0 <../v0.2.0/index.html>`_
190192
* `0.1.3 <../v0.1.3/index.html>`_
191193
* `0.1.2 <../v0.1.2/index.html>`_

_unittests/onnx-numpy-skips.txt

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ array_api_tests/test_creation_functions.py::test_asarray_arrays
66
array_api_tests/test_creation_functions.py::test_empty
77
array_api_tests/test_creation_functions.py::test_empty_like
88
array_api_tests/test_creation_functions.py::test_eye
9+
array_api_tests/test_creation_functions.py::test_full
10+
array_api_tests/test_creation_functions.py::test_full_like
11+
array_api_tests/test_creation_functions.py::test_ones
12+
array_api_tests/test_creation_functions.py::test_ones_like
13+
array_api_tests/test_creation_functions.py::test_zeros
14+
array_api_tests/test_creation_functions.py::test_zeros_like
915
# fails to precision issue
1016
array_api_tests/test_creation_functions.py::test_linspace
1117
array_api_tests/test_creation_functions.py::test_meshgrid

_unittests/ut_array_api/test_hypothesis_array_api.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import unittest
2-
import warnings
32
from os import getenv
43
from functools import reduce
54
import packaging.version as pv
@@ -45,12 +44,7 @@ class TestHypothesisArraysApis(ExtTestCase):
4544

4645
@classmethod
4746
def setUpClass(cls):
48-
try:
49-
import array_api_strict as xp
50-
except ImportError:
51-
with warnings.catch_warnings():
52-
warnings.simplefilter("ignore")
53-
from numpy import array_api as xp
47+
import array_api_strict as xp
5448

5549
api_version = getenv(
5650
"ARRAY_API_TESTS_VERSION",

_unittests/ut_graph_api/test_graph_builder.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import unittest
44
import numpy as np
55
import onnx
6-
from onnx_array_api.ext_test_case import ExtTestCase
6+
from onnx_array_api.ext_test_case import ExtTestCase, skipif_ci_apple
77
from onnx_array_api.graph_api.graph_builder import GraphBuilder, OptimizationOptions
88
from onnx_array_api.reference import (
99
from_array_extended,
@@ -107,6 +107,7 @@ def test_simple_big(self):
107107
got = ref.run(None, feeds)
108108
self.assertEqualArray(expected, got[0])
109109

110+
@skipif_ci_apple("libomp is missing")
110111
def test_constant_folding(self):
111112
with contextlib.redirect_stdout(io.StringIO()):
112113
g = GraphBuilder(verbose=10)
@@ -133,6 +134,7 @@ def test_constant_folding(self):
133134
got = ref.run(None, feeds)
134135
self.assertEqualArray(expected, got[0])
135136

137+
@skipif_ci_apple("libomp is missing")
136138
def test_constant_folding2(self):
137139
g = GraphBuilder(
138140
optimization_options=OptimizationOptions(constant_folding=True)
@@ -270,6 +272,7 @@ def test_remove_unused_nodes_simple(self):
270272
got = ref.run(None, feeds)
271273
self.assertEqualArray(expected, got[0])
272274

275+
@skipif_ci_apple("libomp is missing")
273276
def test_constant_array(self):
274277
with contextlib.redirect_stdout(io.StringIO()):
275278
g = GraphBuilder(verbose=10)
@@ -290,6 +293,7 @@ def test_constant_array(self):
290293
got = ref.run(None, feeds)
291294
self.assertEqualArray(expected, got[0])
292295

296+
@skipif_ci_apple("libomp is missing")
293297
def test_constant_array_2(self):
294298
with contextlib.redirect_stdout(io.StringIO()):
295299
g = GraphBuilder(verbose=10)

_unittests/ut_npx/test_npx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def local1(
208208
return x
209209

210210
def local2(
211-
x: TensorType[ElemType.floats, "T"]
211+
x: TensorType[ElemType.floats, "T"],
212212
) -> TensorType[ElemType.floats, "T"]:
213213
return x
214214

azure-pipelines.yml

+5-52
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ jobs:
139139
cd array-api-tests
140140
python -m pytest -x array_api_tests/test_creation_functions.py --skips-file=../_unittests/onnx-numpy-skips.txt --hypothesis-explain
141141
displayName: "numpy test_creation_functions.py"
142-
- script: |
143-
export ARRAY_API_TESTS_MODULE=onnx_array_api.array_api.onnx_ort
144-
cd array-api-tests
145-
python -m pytest -x array_api_tests/test_creation_functions.py --skips-file=../_unittests/onnx-ort-skips.txt --hypothesis-explain
146-
displayName: "ort test_creation_functions.py"
142+
# - script: |
143+
# export ARRAY_API_TESTS_MODULE=onnx_array_api.array_api.onnx_ort
144+
# cd array-api-tests
145+
# python -m pytest -x array_api_tests/test_creation_functions.py --skips-file=../_unittests/onnx-ort-skips.txt --hypothesis-explain
146+
# displayName: "ort test_creation_functions.py"
147147
#- script: |
148148
# export ARRAY_API_TESTS_MODULE=onnx_array_api.array_api.onnx_numpy
149149
# cd array-api-tests
@@ -238,50 +238,3 @@ jobs:
238238
inputs:
239239
artifactName: 'wheel-windows-$(python.version)'
240240
targetPath: 'dist'
241-
242-
- job: 'TestMac'
243-
pool:
244-
vmImage: 'macOS-latest'
245-
strategy:
246-
matrix:
247-
Python311-Mac:
248-
python.version: '3.11'
249-
maxParallel: 3
250-
251-
steps:
252-
- task: UsePythonVersion@0
253-
inputs:
254-
versionSpec: '$(python.version)'
255-
architecture: 'x64'
256-
- script: gcc --version
257-
displayName: 'gcc version'
258-
#- script: brew upgrade
259-
# displayName: 'brew upgrade'
260-
#- script: brew update
261-
# displayName: 'brew update'
262-
- script: export
263-
displayName: 'export'
264-
- script: gcc --version
265-
displayName: 'gcc version'
266-
- script: python -m pip install --upgrade pip setuptools wheel
267-
displayName: 'Install tools'
268-
- script: pip install -r requirements.txt
269-
displayName: 'Install Requirements'
270-
- script: pip install -r requirements-dev.txt
271-
displayName: 'Install Requirements dev'
272-
- script: pip install onnxmltools --no-deps
273-
displayName: 'Install onnxmltools'
274-
- script: |
275-
python -m pip freeze
276-
displayName: 'pip freeze'
277-
- script: |
278-
python -m pytest
279-
displayName: 'Runs Unit Tests'
280-
- script: |
281-
python -u setup.py bdist_wheel
282-
displayName: 'Build Package'
283-
- task: PublishPipelineArtifact@0
284-
inputs:
285-
artifactName: 'wheel-mac-$(python.version)'
286-
targetPath: 'dist'
287-

onnx_array_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
APIs to create ONNX Graphs.
33
"""
44

5-
__version__ = "0.2.0"
5+
__version__ = "0.3.0"
66
__author__ = "Xavier Dupré"

onnx_array_api/array_api/_onnx_common.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
from typing import Any, Optional
2-
import warnings
32
import numpy as np
43
from onnx import TensorProto
5-
6-
try:
7-
import array_api_strict
8-
9-
Array = type(array_api_strict.ones((1,)))
10-
except ImportError:
11-
with warnings.catch_warnings():
12-
warnings.simplefilter("ignore")
13-
from numpy.array_api._array_object import Array
4+
import array_api_strict
145

156
from ..npx.npx_types import (
167
DType,
@@ -36,6 +27,9 @@
3627
)
3728

3829

30+
Array = type(array_api_strict.ones((1,)))
31+
32+
3933
# These functions with no specific code do not have to be
4034
# implemented. They are automatically added in
4135
# :mod:`onnx_array_api.array_api`. It needs

onnx_array_api/npx/npx_functions_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222

2323
@npxapi_function
2424
def _min_max(
25-
x: TensorType[ElemType.numerics, "T"]
25+
x: TensorType[ElemType.numerics, "T"],
2626
) -> TupleType[TensorType[ElemType.numerics, "T"], TensorType[ElemType.numerics, "T"]]:
2727
return tuple_var(var(x, op="ReduceMin"), var(x, op="ReduceMax"))
2828

2929

3030
@npxapi_inline
3131
def _min_max_inline(
32-
x: TensorType[ElemType.numerics, "T"]
32+
x: TensorType[ElemType.numerics, "T"],
3333
) -> TupleType[TensorType[ElemType.numerics, "T"], TensorType[ElemType.numerics, "T"]]:
3434
return tuple_var(var(x, op="ReduceMin"), var(x, op="ReduceMax"))
3535

3636

3737
@npxapi_function
3838
def absolute(
39-
x: TensorType[ElemType.numerics, "T"]
39+
x: TensorType[ElemType.numerics, "T"],
4040
) -> TensorType[ElemType.numerics, "T"]:
4141
"See :func:`numpy.absolute`."
4242
return var(x, op="Abs")
@@ -90,7 +90,7 @@ def log1p(x: TensorType[ElemType.floats, "T"]) -> TensorType[ElemType.floats, "T
9090

9191
@npxapi_function
9292
def negative(
93-
x: TensorType[ElemType.numerics, "T"]
93+
x: TensorType[ElemType.numerics, "T"],
9494
) -> TensorType[ElemType.numerics, "T"]:
9595
"See :func:`numpy.negative`."
9696
return var(x, op="Neg")

onnx_array_api/validation/tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
def randomize_proto(
23-
onx: Union[ModelProto, GraphProto, FunctionProto, NodeProto, TensorProto]
23+
onx: Union[ModelProto, GraphProto, FunctionProto, NodeProto, TensorProto],
2424
) -> Union[ModelProto, GraphProto, FunctionProto, NodeProto, TensorProto]:
2525
"""
2626
Randomizes float initializers or constant nodes.

0 commit comments

Comments
 (0)