Skip to content

Commit

Permalink
Address shape inference failure (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagoel4512 authored Oct 23, 2023
1 parent 701e8ba commit 44388d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
Change log
==========

0.9.3 (Unreleased)
------------------

**Bug fix**

- Address missing Value Infos when building singleton model for shape inference.


0.9.2 (2023-10-20)
------------------

Expand All @@ -17,7 +25,7 @@ Change log
0.9.1 (2023-10-05)
------------------

**Bug fix**
**Bug fixes**

- The node-adaption no longer fails if faced with a node that has repeating inputs.
- Forego version adaption of inlined models if no nodes are from the default domain.
Expand Down
8 changes: 6 additions & 2 deletions src/spox/_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,16 @@ def _make_dummy_subgraph(_node: Node, key: str, graph: "Graph") -> onnx.GraphPro
inputs = []
for i, arr in enumerate(graph.requested_arguments):
inputs.append(arr.unwrap_type()._to_onnx_value_info(f"__dummy_input{i}"))

value_infos = []
nodes = []
outputs = []
for i, arr in enumerate(graph.requested_results.values()):
outer = f"__dummy_outer_output{i}"
value_infos.append(arr.unwrap_type()._to_onnx_value_info(outer))
out = f"__dummy_output{i}"
outputs.append(arr.unwrap_type()._to_onnx_value_info(out))
nodes.append(onnx.helper.make_node("Identity", [outer], [out]))

return onnx.helper.make_graph(nodes, f"__dummy_{key}", inputs, outputs)
return onnx.helper.make_graph(
nodes, f"__dummy_{key}", inputs, outputs, value_info=value_infos
)
2 changes: 1 addition & 1 deletion tests/test_adapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def old_squeeze() -> onnx.ModelProto:
>
agraph (float[1, N] A) => (float[N] B)
{
B = Squeeze<axes: floats = [0]>(A)
B = Squeeze<axes = [0]>(A)
}
"""
)
Expand Down

0 comments on commit 44388d5

Please sign in to comment.