Commit 07886118 by Liang Luo Committed by Tianqi Chen

maximum relay op V2 (#1838)

parent c286c138
......@@ -54,6 +54,7 @@ This level enables typical convnet models.
tvm.relay.greater_equal
tvm.relay.less
tvm.relay.less_equal
tvm.relay.maximum
**Level 5: Vision/Image Operators**
......@@ -82,3 +83,4 @@ Level 4 Definitions
.. autofunction:: tvm.relay.greater_equal
.. autofunction:: tvm.relay.less
.. autofunction:: tvm.relay.less_equal
.. autofunction:: tvm.relay.maximum
\ No newline at end of file
......@@ -228,6 +228,24 @@ def greater_equal(lhs, rhs):
return _make.greater_equal(lhs, rhs)
def maximum(lhs, rhs):
"""Maximum with numpy-style broadcasting.
Parameters
----------
lhs : relay.Expr
The left hand side input data
rhs : relay.Expr
The right hand side input data
Returns
-------
result : relay.Expr
The computed result.
"""
return _make.maximum(lhs, rhs)
def right_shift(lhs, rhs):
"""Right shift with numpy-style broadcasting.
......
......@@ -37,10 +37,13 @@ RELAY_REGISTER_BINARY_OP("right_shift")
.describe("Elementwise right shift with broadcasting")
.set_support_level(4);
// Left shift
RELAY_REGISTER_BINARY_OP("left_shift")
.describe("Elementwise left shift with broadcasting")
.set_support_level(4);
RELAY_REGISTER_BINARY_OP("maximum")
.describe("Elementwise maximum of two tensors with broadcasting")
.set_support_level(4);
// Comparisons
#define RELAY_REGISTER_CMP_OP(OpName) \
......
......@@ -21,8 +21,9 @@ def test_cmp_type():
def test_binary_broadcast():
for op in (relay.right_shift,
relay.left_shift):
for op in [relay.right_shift,
relay.left_shift,
relay.maximum]:
ib = relay.ir_builder.IRBuilder()
x = ib.param("x", relay.TensorType((10, 4), "int32"))
y = ib.param("y", relay.TensorType((5, 10, 1), "int32"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment