Skip to content
Closed
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
18 changes: 18 additions & 0 deletions python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,22 @@ def _impl_v7(cls, inputs, attr, params):
return _op.less(inputs[0], inputs[1])


class LessOrEqual(OnnxOpConverter):
"""Operator logical less or equal than."""

@classmethod
def _impl_v12(cls, inputs, attr, params):
return _op.less_equal(inputs[0], inputs[1])


class GreaterOrEqual(OnnxOpConverter):
"""Operator logical greater or equal than."""

@classmethod
def _impl_v12(cls, inputs, attr, params):
return _op.greater_equal(inputs[0], inputs[1])


class LRN(OnnxOpConverter):
"""Operator converter for Local Response Normalization."""

Expand Down Expand Up @@ -3477,6 +3493,8 @@ def _get_convert_map(opset):
"Exp": Renamer("exp"),
"Greater": Greater.get_converter(opset),
"Less": Less.get_converter(opset),
"LessOrEqual": LessOrEqual.get_converter(opset),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just use Renamer, you are just forwarding the inputs in the converter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E.g. see #8967

"GreaterOrEqual": GreaterOrEqual.get_converter(opset),
"Log": Renamer("log"),
"Acos": Renamer("acos"),
"Acosh": Renamer("acosh"),
Expand Down
4 changes: 4 additions & 0 deletions tests/python/frontend/onnx/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1927,8 +1927,12 @@ def verify_binary_ops(op, x, y, out_type="float32"):
verify_binary_ops("Sum", x, z)
verify_binary_ops("Greater", x, y, "bool")
verify_binary_ops("Greater", x, z, "bool")
verify_binary_ops("GreaterOrEqual", x, y, "bool")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you uncomment the appropriate tests in unsupported_onnx_tests in this file?

verify_binary_ops("GreaterOrEqual", x, z, "bool")
verify_binary_ops("Less", x, y, "bool")
verify_binary_ops("Less", x, z, "bool")
verify_binary_ops("LessOrEqual", x, y, "bool")
verify_binary_ops("LessOrEqual", x, z, "bool")
verify_binary_ops("Equal", x, y, "bool")
verify_binary_ops("Equal", x, z, "bool")

Expand Down