Skip to content

Support translation of local functions #60

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
verbose
  • Loading branch information
xadupre committed Jan 8, 2024
commit e531c13f1763c47ec2d58dfebeaddb53fa2d20b6
7 changes: 5 additions & 2 deletions _unittests/ut_light_api/test_backend_export.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import unittest
from typing import Any, Dict, List, Optional
from difflib import unified_diff
Expand Down Expand Up @@ -25,6 +26,8 @@
from onnx_array_api.light_api import translate
from onnx_array_api.plotting.text_plot import onnx_simple_text_plot

verbosity = 10 if "-v" in sys.argv or "--verbose" in sys.argv else 0


class ReferenceImplementationError(RuntimeError):
"Fails, export cannot be compared."
Expand All @@ -36,7 +39,7 @@ class ExportWrapper:

def __init__(self, model):
self.model = model
self.expected_sess = ExtendedReferenceEvaluator(self.model)
self.expected_sess = ExtendedReferenceEvaluator(self.model, verbose=verbosity)

@property
def input_names(self):
Expand Down Expand Up @@ -109,7 +112,7 @@ def run(
f"Unable to executed code for api {api!r}\n{new_code}"
) from e
export_model = locs["model"]
ref = ExtendedReferenceEvaluator(export_model)
ref = ExtendedReferenceEvaluator(export_model, verbose=verbosity)
try:
got = ref.run(names, feeds)
except (TypeError, AttributeError) as e:
Expand Down
22 changes: 9 additions & 13 deletions onnx_array_api/light_api/make_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ def make_node_extended(
"""
Constructs a NodeProto.

Args:
op_type: The name of the operator to construct
inputs: list of input names
outputs: list of output names
name: optional unique identifier for NodeProto
doc_string: optional documentation string for NodeProto
domain: optional domain for NodeProto.
If it's None, we will just use default domain (which is empty)
**kwargs (dict): the attributes of the node. The acceptable values
are documented in :func:`make_attribute`.

Returns:
NodeProto
:param op_type: The name of the operator to construct
:param inputs: list of input names
:param outputs: list of output names
:param name: optional unique identifier for NodeProto
:param doc_string: optional documentation string for NodeProto
:param domain: optional domain for NodeProto.
If it's None, we will just use default domain (which is empty)
:param kwargs: the attributes of the node.
:return: node proto
"""
node = NodeProto()
node.op_type = op_type
Expand Down