Skip to content

Supports subgraph in the light API #48

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 18 commits into from
Nov 13, 2023
Merged
Prev Previous commit
Next Next commit
rename
  • Loading branch information
xadupre committed Nov 13, 2023
commit ad82c19ec08d43448c063202727df8b0db20f707
8 changes: 4 additions & 4 deletions _unittests/ut_light_api/test_translate_classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_check_code(self):
outputs.append(make_tensor_value_info("Y", TensorProto.FLOAT, shape=[]))
graph = make_graph(
nodes,
"noname",
"onename",
inputs,
outputs,
initializers,
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_exp(self):
outputs.append(make_tensor_value_info('Y', TensorProto.FLOAT, shape=[]))
graph = make_graph(
nodes,
'noname',
'light_api',
inputs,
outputs,
initializers,
Expand Down Expand Up @@ -161,7 +161,7 @@ def test_transpose(self):
outputs.append(make_tensor_value_info('Y', TensorProto.FLOAT, shape=[]))
graph = make_graph(
nodes,
'noname',
'light_api',
inputs,
outputs,
initializers,
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_topk_reverse(self):
outputs.append(make_tensor_value_info('Indices', TensorProto.FLOAT, shape=[]))
graph = make_graph(
nodes,
'noname',
'light_api',
inputs,
outputs,
initializers,
Expand Down
3 changes: 2 additions & 1 deletion onnx_array_api/light_api/inner_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ def _emit_begin_graph(self, **kwargs: Dict[str, Any]) -> List[str]:
return lines

def _emit_end_graph(self, **kwargs: Dict[str, Any]) -> List[str]:
name = kwargs.get("name", "noname")
lines = [
"graph = make_graph(",
" nodes,",
" 'noname',",
f" {name!r},",
" inputs,",
" outputs,",
" initializers,",
Expand Down
7 changes: 6 additions & 1 deletion onnx_array_api/light_api/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,16 @@ def export(self, as_str, single_line: bool = False) -> Union[str, List[str]]:
),
)
)
if isinstance(self.proto_, (GraphProto, FunctionProto)):
name = self.proto_.name
else:
name = self.proto_.graph.name
rows.extend(
self.emitter(
EventType.END_FUNCTION
if isinstance(self.proto_, FunctionProto)
else EventType.END_GRAPH
else EventType.END_GRAPH,
name=name,
)
)

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy