Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
07886118
Commit
07886118
authored
Oct 05, 2018
by
Liang Luo
Committed by
Tianqi Chen
Oct 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maximum relay op V2 (#1838)
parent
c286c138
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
+28
-3
docs/langref/relay_op.rst
+3
-0
python/tvm/relay/op/tensor.py
+18
-0
src/relay/op/tensor/binary.cc
+4
-1
tests/python/relay/test_op_level4.py
+3
-2
No files found.
docs/langref/relay_op.rst
View file @
07886118
...
...
@@ -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
python/tvm/relay/op/tensor.py
View file @
07886118
...
...
@@ -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.
...
...
src/relay/op/tensor/binary.cc
View file @
07886118
...
...
@@ -37,11 +37,14 @@ 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) \
TVM_REGISTER_API("relay.op._make." OpName) \
...
...
tests/python/relay/test_op_level4.py
View file @
07886118
...
...
@@ -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"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment