-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bump ONNX versions * Bump ORT version for improved test coverage * Fix generate script importlib usage on 3.11 This usage was seemingly not using defined behaviour. importlib.resources.path is also deprecated from 3.11, but a replacement is available only from 3.9 which we are yet to be on. * Regenerate ai.onnx@17 Small changes to docstrings * Add rtol capability to testing routine * Run more function tests after ORT fixes There are still very odd build errors on more complex cases, due to colliding (pseudo-random?) identifiers. * Use non-deprecated onnx.mapping alternative * Avoid usage of onnx.mapping in utils As it is becoming deprecated. Brings up the issue of object-str for the string dtype in Spox. * Integrate reference implementation of operators * Remove ORT value prop * Minor membership test fix * Create module for propagated value wrapper * Fix type-hints around PropValue abstraction * Apply wrapper more often and fix ref integration * Patch found broken implementations * Add switch for value propagation runtime * Add more consistency checks * Be more strict with PropValue types * Update src/spox/_standard.py Co-authored-by: Christian Bourjau <[email protected]> * Comment on value representation cases Co-authored-by: Jakub Bachurski <[email protected]> Co-authored-by: Christian Bourjau <[email protected]> Co-authored-by: Jakub Bachurski <[email protected]> Co-authored-by: Christian Bourjau <[email protected]>
- Loading branch information
1 parent
7647b62
commit a6c7cb0
Showing
20 changed files
with
390 additions
and
194 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -21,7 +21,7 @@ requirements: | |
run: | ||
- python >=3.8 | ||
- numpy | ||
- onnx | ||
- onnx >=1.13 | ||
|
||
test: | ||
requires: | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,28 @@ | ||
import numpy | ||
import onnx | ||
import onnx.reference.op_run | ||
import onnx.reference.ops._op_list | ||
import onnx.reference.ops.op_cast | ||
from onnx.reference.op_run import OpRun | ||
|
||
|
||
class PatchedOptionalHasElement(OpRun): | ||
def _run(self, x): | ||
return (numpy.array(not ((isinstance(x, list) and x == [None]) or x is None)),) | ||
|
||
|
||
class PatchedCast(OpRun): | ||
def _run(self, x, to=None): # type: ignore | ||
if to == onnx.TensorProto.STRING: | ||
return (x.astype(numpy.str_),) | ||
return (onnx.reference.ops.op_cast.cast_to(x, to),) | ||
|
||
|
||
def patch_reference_implementations(): | ||
"""Patch known broken reference implementations in ONNX. | ||
As the reference implementation module in ONNX is quite new, it still has bugs which are a nuisance in Spox. | ||
This function modifies their implementation by catching out the special cases known to be faulty. | ||
""" | ||
onnx.reference.ops._op_list.OptionalHasElement = PatchedOptionalHasElement | ||
onnx.reference.ops._op_list.Cast = PatchedCast |
This file contains 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
This file contains 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
This file contains 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.