Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/pyrefly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
pip install pyrefly
pip install -r requirements.txt
pip install transformers pandas matplotlib openpyxl
pip install transformers pandas matplotlib openpyxl onnx-array-api

- name: Run pyrefly
run: pyrefly check
40 changes: 18 additions & 22 deletions _unittests/ut_helpers/test_onnx_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ def _get_cdist_implementation(
opsets: Dict[str, int],
**kwargs: Any,
) -> FunctionProto:
"""
Returns the CDist implementation as a function.
"""
"""Returns the CDist implementation as a function."""
assert len(node_inputs) == 2
assert len(node_outputs) == 1
assert opsets
Expand All @@ -191,39 +189,39 @@ def _get_cdist_implementation(
metric = kwargs["metric"]
assert metric in ("euclidean", "sqeuclidean")
# subgraph
nodes = [
oh.make_node("Sub", ["next", "next_in"], ["diff"]),
oh.make_node("Constant", [], ["axis"], value_ints=[1]),
oh.make_node("ReduceSumSquare", ["diff", "axis"], ["scan_out"], keepdims=0),
oh.make_node("Identity", ["next_in"], ["next_out"]),
]

def make_value(name):
value = ValueInfoProto()
value.name = name
return value

graph = oh.make_graph(
nodes,
[
oh.make_node("Sub", ["next", "next_in"], ["diff"]),
oh.make_node("Constant", [], ["axis"], value_ints=[1]),
oh.make_node("ReduceSumSquare", ["diff", "axis"], ["scan_out"], keepdims=0),
oh.make_node("Identity", ["next_in"], ["next_out"]),
],
"loop",
[make_value("next_in"), make_value("next")],
[make_value("next_out"), make_value("scan_out")],
)

scan = oh.make_node(
"Scan", ["xb", "xa"], ["next_out", "zout"], num_scan_inputs=1, body=graph
)
final = (
oh.make_node("Sqrt", ["zout"], ["z"])
if metric == "euclidean"
else oh.make_node("Identity", ["zout"], ["z"])
)
return oh.make_function(
"npx",
f"CDist_{metric}",
["xa", "xb"],
["z"],
[scan, final],
[
oh.make_node(
"Scan", ["xb", "xa"], ["next_out", "zout"], num_scan_inputs=1, body=graph
),
(
oh.make_node("Sqrt", ["zout"], ["z"])
if metric == "euclidean"
else oh.make_node("Identity", ["zout"], ["z"])
),
],
[oh.make_opsetid("", opsets[""])],
)

Expand All @@ -234,9 +232,7 @@ def test_iterate_function(self):
)
model = oh.make_model(
oh.make_graph(
[
oh.make_node(proto.name, ["X", "Y"], ["Z"]),
],
[oh.make_node(proto.name, ["X", "Y"], ["Z"])],
"dummy",
[
oh.make_tensor_value_info("X", itype, [None, None]),
Expand Down
5 changes: 0 additions & 5 deletions _unittests/ut_xrun_doc/test_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
has_cuda,
has_onnxscript,
)
from onnx_diagnostic.api import TensorLike


class TestUnitTest(ExtTestCase):
Expand Down Expand Up @@ -111,10 +110,6 @@ def test_measure_time_max(self):
},
)

def test_exc(self):
self.assertRaise(lambda: TensorLike().dtype, NotImplementedError)
self.assertRaise(lambda: TensorLike().shape, NotImplementedError)


if __name__ == "__main__":
unittest.main(verbosity=2)
15 changes: 0 additions & 15 deletions onnx_diagnostic/api.py

This file was deleted.

Loading
Loading