- Notifications
You must be signed in to change notification settings - Fork0
Fixes Array API with onnxruntime#3
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
10 commits Select commitHold shift + click to select a range
602fd9e
Check Array API with onnxruntime
xadupre4970e88
xMerge branch 'main' of https://github.com/sdpython/onnx-array-api in…
xadupre8068ea9
better error message
xadupre0331112
improvment
xadupre0775586
disable one test for older version of sklearn
xadupre4da42fe
add one more pipeline
xadupre4c980ba
fix pipeline
xaduprede537c1
fix array api
xadupre902ba25
remove unnecessary code
xadupre3687ea6
disable one test one the current scikit-learn version
xadupreFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletionsCHANGELOGS.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Change Logs | ||
=========== | ||
0.2.0 | ||
+++++ | ||
* :pr:`3`: fixes Array API with onnxruntime |
7 changes: 6 additions & 1 deletion_doc/conf.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions_doc/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
19 changes: 6 additions & 13 deletions_unittests/ut_npx/test_sklearn_array_api.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions_unittests/ut_ort/test_sklearn_array_api_ort.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import unittest | ||
import numpy as np | ||
from packaging.version import Version | ||
from onnx.defs import onnx_opset_version | ||
from sklearn import config_context, __version__ as sklearn_version | ||
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis | ||
from onnx_array_api.ext_test_case import ExtTestCase | ||
from onnx_array_api.ort.ort_tensors import EagerOrtTensor, OrtTensor | ||
DEFAULT_OPSET = onnx_opset_version() | ||
class TestSklearnArrayAPIOrt(ExtTestCase): | ||
@unittest.skipIf( | ||
Version(sklearn_version) <= Version("1.2.2"), | ||
reason="reshape ArrayAPI not followed", | ||
) | ||
def test_sklearn_array_api_linear_discriminant(self): | ||
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) | ||
y = np.array([1, 1, 1, 2, 2, 2]) | ||
ana = LinearDiscriminantAnalysis() | ||
ana.fit(X, y) | ||
expected = ana.predict(X) | ||
new_x = EagerOrtTensor(OrtTensor.from_array(X)) | ||
self.assertEqual(new_x.device_name, "Cpu") | ||
self.assertStartsWith( | ||
"EagerOrtTensor(OrtTensor.from_array(array([[", repr(new_x) | ||
) | ||
with config_context(array_api_dispatch=True): | ||
got = ana.predict(new_x) | ||
self.assertEqualArray(expected, got.numpy()) | ||
if __name__ == "__main__": | ||
# import logging | ||
# logging.basicConfig(level=logging.DEBUG) | ||
unittest.main(verbosity=2) |
47 changes: 47 additions & 0 deletionsazure-pipelines.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
20 changes: 16 additions & 4 deletionsonnx_array_api/npx/npx_array_api.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletionsonnx_array_api/npx/npx_core_api.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
33 changes: 30 additions & 3 deletionsonnx_array_api/npx/npx_functions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletionsonnx_array_api/npx/npx_graph_builder.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
32 changes: 23 additions & 9 deletionsonnx_array_api/npx/npx_jit_eager.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletionsonnx_array_api/npx/npx_numpy_tensors.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.