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

Upgrade version#94

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 10 commits intomainfromvers
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
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
2 changes: 1 addition & 1 deletion.github/workflows/documentation.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,6 +83,6 @@ jobs:
exit 1
fi

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./dist/html/**
2 changes: 1 addition & 1 deletion.github/workflows/wheels-any.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,6 +24,6 @@ jobs:
- name: build wheel
run: python -m pip wheel .

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./onnx_array_api*.whl
1 change: 1 addition & 0 deletionsCHANGELOGS.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ Change Logs
0.3.0
+++++

* :pr:`93`: fixes evaluator type in ``compare_onnx_execution``
* :pr:`92`: avoids recursion errors in profiling
* :pr:`87`: adds command line to replace contant by ConstantOfShape
* :pr:`79`: first draft to export to GraphBuilder
Expand Down
6 changes: 2 additions & 4 deletions_doc/conf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -146,11 +146,9 @@
"torch.onnx": "https://pytorch.org/docs/stable/onnx.html",
#
"C_OrtValue": (
"http://www.xavierdupre.fr/app/onnxcustom/helpsphinx/"
"api/onnxruntime_python/ortvalue.html#c-class-ortvalue-or-c-ortvalue"
"https://onnxruntime.ai/docs/api/csharp/api/Microsoft.ML.OnnxRuntime.OrtValue.html"
),
"OrtValue": (
"http://www.xavierdupre.fr/app/onnxcustom/helpsphinx/"
"api/onnxruntime_python/ortvalue.html#onnxruntime.OrtValue"
"https://onnxruntime.ai/docs/api/python/api_summary.html#onnxruntime.OrtValue"
),
}
2 changes: 2 additions & 0 deletions_doc/index.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,5 +187,7 @@ to know onnx for that. See :ref:`l-numpy-api-onnx`.
Older versions
++++++++++++++

* `0.3.0 <../v0.3.0/index.html>`_
* `0.2.0 <../v0.2.0/index.html>`_
* `0.1.3 <../v0.1.3/index.html>`_
* `0.1.2 <../v0.1.2/index.html>`_
6 changes: 6 additions & 0 deletions_unittests/onnx-numpy-skips.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,12 @@ array_api_tests/test_creation_functions.py::test_asarray_arrays
array_api_tests/test_creation_functions.py::test_empty
array_api_tests/test_creation_functions.py::test_empty_like
array_api_tests/test_creation_functions.py::test_eye
array_api_tests/test_creation_functions.py::test_full
array_api_tests/test_creation_functions.py::test_full_like
array_api_tests/test_creation_functions.py::test_ones
array_api_tests/test_creation_functions.py::test_ones_like
array_api_tests/test_creation_functions.py::test_zeros
array_api_tests/test_creation_functions.py::test_zeros_like
# fails to precision issue
array_api_tests/test_creation_functions.py::test_linspace
array_api_tests/test_creation_functions.py::test_meshgrid
8 changes: 1 addition & 7 deletions_unittests/ut_array_api/test_hypothesis_array_api.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
import unittest
import warnings
from os import getenv
from functools import reduce
import packaging.version as pv
Expand DownExpand Up@@ -45,12 +44,7 @@ class TestHypothesisArraysApis(ExtTestCase):

@classmethod
def setUpClass(cls):
try:
import array_api_strict as xp
except ImportError:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from numpy import array_api as xp
import array_api_strict as xp

api_version = getenv(
"ARRAY_API_TESTS_VERSION",
Expand Down
6 changes: 5 additions & 1 deletion_unittests/ut_graph_api/test_graph_builder.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
import unittest
import numpy as np
import onnx
from onnx_array_api.ext_test_case import ExtTestCase
from onnx_array_api.ext_test_case import ExtTestCase, skipif_ci_apple
from onnx_array_api.graph_api.graph_builder import GraphBuilder, OptimizationOptions
from onnx_array_api.reference import (
from_array_extended,
Expand DownExpand Up@@ -107,6 +107,7 @@ def test_simple_big(self):
got = ref.run(None, feeds)
self.assertEqualArray(expected, got[0])

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

@skipif_ci_apple("libomp is missing")
def test_constant_folding2(self):
g = GraphBuilder(
optimization_options=OptimizationOptions(constant_folding=True)
Expand DownExpand Up@@ -270,6 +272,7 @@ def test_remove_unused_nodes_simple(self):
got = ref.run(None, feeds)
self.assertEqualArray(expected, got[0])

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

@skipif_ci_apple("libomp is missing")
def test_constant_array_2(self):
with contextlib.redirect_stdout(io.StringIO()):
g = GraphBuilder(verbose=10)
Expand Down
2 changes: 1 addition & 1 deletion_unittests/ut_npx/test_npx.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -208,7 +208,7 @@ def local1(
return x

def local2(
x: TensorType[ElemType.floats, "T"]
x: TensorType[ElemType.floats, "T"],
) -> TensorType[ElemType.floats, "T"]:
return x

Expand Down
57 changes: 5 additions & 52 deletionsazure-pipelines.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -139,11 +139,11 @@ jobs:
cd array-api-tests
python -m pytest -x array_api_tests/test_creation_functions.py --skips-file=../_unittests/onnx-numpy-skips.txt --hypothesis-explain
displayName: "numpy test_creation_functions.py"
- script: |
export ARRAY_API_TESTS_MODULE=onnx_array_api.array_api.onnx_ort
cd array-api-tests
python -m pytest -x array_api_tests/test_creation_functions.py --skips-file=../_unittests/onnx-ort-skips.txt --hypothesis-explain
displayName: "ort test_creation_functions.py"
#- script: |
# export ARRAY_API_TESTS_MODULE=onnx_array_api.array_api.onnx_ort
# cd array-api-tests
# python -m pytest -x array_api_tests/test_creation_functions.py --skips-file=../_unittests/onnx-ort-skips.txt --hypothesis-explain
# displayName: "ort test_creation_functions.py"
#- script: |
# export ARRAY_API_TESTS_MODULE=onnx_array_api.array_api.onnx_numpy
# cd array-api-tests
Expand DownExpand Up@@ -238,50 +238,3 @@ jobs:
inputs:
artifactName: 'wheel-windows-$(python.version)'
targetPath: 'dist'

- job: 'TestMac'
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Python311-Mac:
python.version: '3.11'
maxParallel: 3

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: gcc --version
displayName: 'gcc version'
#- script: brew upgrade
# displayName: 'brew upgrade'
#- script: brew update
# displayName: 'brew update'
- script: export
displayName: 'export'
- script: gcc --version
displayName: 'gcc version'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- script: pip install -r requirements.txt
displayName: 'Install Requirements'
- script: pip install -r requirements-dev.txt
displayName: 'Install Requirements dev'
- script: pip install onnxmltools --no-deps
displayName: 'Install onnxmltools'
- script: |
python -m pip freeze
displayName: 'pip freeze'
- script: |
python -m pytest
displayName: 'Runs Unit Tests'
- script: |
python -u setup.py bdist_wheel
displayName: 'Build Package'
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'wheel-mac-$(python.version)'
targetPath: 'dist'

2 changes: 1 addition & 1 deletiononnx_array_api/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,5 +2,5 @@
APIs to create ONNX Graphs.
"""

__version__ = "0.2.0"
__version__ = "0.3.0"
__author__ = "Xavier Dupré"
14 changes: 4 additions & 10 deletionsonnx_array_api/array_api/_onnx_common.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
from typing import Any, Optional
import warnings
import numpy as np
from onnx import TensorProto

try:
import array_api_strict

Array = type(array_api_strict.ones((1,)))
except ImportError:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from numpy.array_api._array_object import Array
import array_api_strict

from ..npx.npx_types import (
DType,
Expand All@@ -36,6 +27,9 @@
)


Array = type(array_api_strict.ones((1,)))


# These functions with no specific code do not have to be
# implemented. They are automatically added in
# :mod:`onnx_array_api.array_api`. It needs
Expand Down
8 changes: 4 additions & 4 deletionsonnx_array_api/npx/npx_functions_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,21 +22,21 @@

@npxapi_function
def _min_max(
x: TensorType[ElemType.numerics, "T"]
x: TensorType[ElemType.numerics, "T"],
) -> TupleType[TensorType[ElemType.numerics, "T"], TensorType[ElemType.numerics, "T"]]:
return tuple_var(var(x, op="ReduceMin"), var(x, op="ReduceMax"))


@npxapi_inline
def _min_max_inline(
x: TensorType[ElemType.numerics, "T"]
x: TensorType[ElemType.numerics, "T"],
) -> TupleType[TensorType[ElemType.numerics, "T"], TensorType[ElemType.numerics, "T"]]:
return tuple_var(var(x, op="ReduceMin"), var(x, op="ReduceMax"))


@npxapi_function
def absolute(
x: TensorType[ElemType.numerics, "T"]
x: TensorType[ElemType.numerics, "T"],
) -> TensorType[ElemType.numerics, "T"]:
"See :func:`numpy.absolute`."
return var(x, op="Abs")
Expand DownExpand Up@@ -90,7 +90,7 @@ def log1p(x: TensorType[ElemType.floats, "T"]) -> TensorType[ElemType.floats, "T

@npxapi_function
def negative(
x: TensorType[ElemType.numerics, "T"]
x: TensorType[ElemType.numerics, "T"],
) -> TensorType[ElemType.numerics, "T"]:
"See :func:`numpy.negative`."
return var(x, op="Neg")
Expand Down
2 changes: 1 addition & 1 deletiononnx_array_api/validation/tools.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@


def randomize_proto(
onx: Union[ModelProto, GraphProto, FunctionProto, NodeProto, TensorProto]
onx: Union[ModelProto, GraphProto, FunctionProto, NodeProto, TensorProto],
) -> Union[ModelProto, GraphProto, FunctionProto, NodeProto, TensorProto]:
"""
Randomizes float initializers or constant nodes.
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp