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
168d4d1d
Commit
168d4d1d
authored
Oct 06, 2018
by
Pratyush Patel
Committed by
Tianqi Chen
Oct 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RELAY][OP] Add relay minimum op (#1840)
parent
1bfda4d3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
docs/langref/relay_op.rst
+3
-2
python/tvm/relay/op/tensor.py
+18
-0
src/relay/op/tensor/binary.cc
+4
-0
tests/python/relay/test_op_level4.py
+2
-1
No files found.
docs/langref/relay_op.rst
View file @
168d4d1d
...
@@ -61,6 +61,7 @@ This level enables typical convnet models.
...
@@ -61,6 +61,7 @@ This level enables typical convnet models.
tvm.relay.less
tvm.relay.less
tvm.relay.less_equal
tvm.relay.less_equal
tvm.relay.maximum
tvm.relay.maximum
tvm.relay.minimum
**Level 5: Vision/Image Operators**
**Level 5: Vision/Image Operators**
...
@@ -89,4 +90,5 @@ Level 4 Definitions
...
@@ -89,4 +90,5 @@ Level 4 Definitions
.. autofunction:: tvm.relay.greater_equal
.. autofunction:: tvm.relay.greater_equal
.. autofunction:: tvm.relay.less
.. autofunction:: tvm.relay.less
.. autofunction:: tvm.relay.less_equal
.. autofunction:: tvm.relay.less_equal
.. autofunction:: tvm.relay.maximum
.. autofunction:: tvm.relay.maximum
\ No newline at end of file
.. autofunction:: tvm.relay.minimum
python/tvm/relay/op/tensor.py
View file @
168d4d1d
...
@@ -246,6 +246,24 @@ def maximum(lhs, rhs):
...
@@ -246,6 +246,24 @@ def maximum(lhs, rhs):
return
_make
.
maximum
(
lhs
,
rhs
)
return
_make
.
maximum
(
lhs
,
rhs
)
def
minimum
(
lhs
,
rhs
):
"""Minimum 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
.
minimum
(
lhs
,
rhs
)
def
right_shift
(
lhs
,
rhs
):
def
right_shift
(
lhs
,
rhs
):
"""Right shift with numpy-style broadcasting.
"""Right shift with numpy-style broadcasting.
...
...
src/relay/op/tensor/binary.cc
View file @
168d4d1d
...
@@ -45,6 +45,10 @@ RELAY_REGISTER_BINARY_OP("maximum")
...
@@ -45,6 +45,10 @@ RELAY_REGISTER_BINARY_OP("maximum")
.
describe
(
"Elementwise maximum of two tensors with broadcasting"
)
.
describe
(
"Elementwise maximum of two tensors with broadcasting"
)
.
set_support_level
(
4
);
.
set_support_level
(
4
);
RELAY_REGISTER_BINARY_OP
(
"minimum"
)
.
describe
(
"Elementwise minimum of two tensors with broadcasting"
)
.
set_support_level
(
4
);
// Comparisons
// Comparisons
#define RELAY_REGISTER_CMP_OP(OpName) \
#define RELAY_REGISTER_CMP_OP(OpName) \
TVM_REGISTER_API("relay.op._make." OpName) \
TVM_REGISTER_API("relay.op._make." OpName) \
...
...
tests/python/relay/test_op_level4.py
View file @
168d4d1d
...
@@ -23,7 +23,8 @@ def test_cmp_type():
...
@@ -23,7 +23,8 @@ def test_cmp_type():
def
test_binary_broadcast
():
def
test_binary_broadcast
():
for
op
in
[
relay
.
right_shift
,
for
op
in
[
relay
.
right_shift
,
relay
.
left_shift
,
relay
.
left_shift
,
relay
.
maximum
]:
relay
.
maximum
,
relay
.
minimum
]:
ib
=
relay
.
ir_builder
.
IRBuilder
()
ib
=
relay
.
ir_builder
.
IRBuilder
()
x
=
ib
.
param
(
"x"
,
relay
.
TensorType
((
10
,
4
),
"int32"
))
x
=
ib
.
param
(
"x"
,
relay
.
TensorType
((
10
,
4
),
"int32"
))
y
=
ib
.
param
(
"y"
,
relay
.
TensorType
((
5
,
10
,
1
),
"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