Skip to content

Commit

Permalink
[TUZ-6][OP] Support Greater Operator (apache#45)
Browse files Browse the repository at this point in the history
Add Greater.
  • Loading branch information
zxybazh authored Mar 7, 2023
1 parent 2491e99 commit 1c7baff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/tvm/relax/frontend/onnx_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,16 @@ def _impl_v1(cls, bb, inputs, attr):
return relax.Tuple([ln, mask_index])


class Greater(OnnxOpConverter):
"""Converts an onnx Greater node into an equivalent Relax expression."""

@classmethod
def _impl_v13(cls, bb, inputs, attr):
x = inputs[0]
y = inputs[1]
return relax.op.greater(x, y)


def _get_convert_map():
return {
"MatMul": MatMul,
Expand Down Expand Up @@ -1399,6 +1409,7 @@ def _get_convert_map():
"Resize": Resize,
"Einsum": Einsum,
"Range": Range,
"Greater": Greater,
}


Expand Down
5 changes: 5 additions & 0 deletions tests/python/relax/frontend/test_onnx_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1472,5 +1472,10 @@ def test_flatten():
verify_unary("Flatten", [1, 3, 32, 32], attrs={"axis": 2})


def test_greater():
verify_compare("Greater", [32, 32])
verify_compare("Greater", [64, 16])


if __name__ == "__main__":
tvm.testing.main()

0 comments on commit 1c7baff

Please sign in to comment.