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
5a15664e
Commit
5a15664e
authored
Jun 08, 2018
by
Tatsuya Nishiyama
Committed by
Tianqi Chen
Jun 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PReLU support to mxnet frontend (#1249)
parent
5ba24773
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
nnvm/python/nnvm/frontend/mxnet.py
+4
-3
nnvm/tests/python/frontend/mxnet/test_forward.py
+8
-0
No files found.
nnvm/python/nnvm/frontend/mxnet.py
View file @
5a15664e
...
...
@@ -151,9 +151,10 @@ def _dropout(inputs, attrs):
def
_leaky_relu
(
inputs
,
attrs
):
act_type
=
_required_attr
(
attrs
,
'act_type'
)
if
act_type
in
[
'leaky'
]:
op_name
,
new_attrs
=
'leaky_relu'
,
{}
new_attrs
[
'alpha'
]
=
attrs
.
get
(
'slope'
,
0.25
)
if
act_type
in
[
'leaky'
,
'prelu'
]:
op_name
,
new_attrs
=
act_type
,
{}
if
act_type
==
'leaky'
:
new_attrs
[
'alpha'
]
=
attrs
.
get
(
'slope'
,
0.25
)
sym
=
_get_nnvm_op
(
op_name
)(
*
inputs
,
**
new_attrs
)
elif
act_type
==
'elu'
:
slope
=
attrs
.
get
(
'slope'
,
0.25
)
...
...
nnvm/tests/python/frontend/mxnet/test_forward.py
View file @
5a15664e
...
...
@@ -97,6 +97,13 @@ def test_forward_rrelu():
mx_sym
=
mx
.
sym
.
LeakyReLU
(
data
,
act_type
=
'rrelu'
,
lower_bound
=
0.3
,
upper_bound
=
0.7
)
verify_mxnet_frontend_impl
(
mx_sym
,
(
1
,
3
,
100
,
100
),
(
1
,
6
,
100
,
100
))
def
test_forward_prelu
():
data
=
mx
.
sym
.
var
(
'data'
)
data
=
mx
.
sym
.
concat
(
data
,
-
data
,
dim
=
1
)
# negative part explicitly
gamma
=
mx
.
sym
.
zeros
(
shape
=
(
6
,))
mx_sym
=
mx
.
sym
.
LeakyReLU
(
data
,
gamma
=
gamma
,
act_type
=
'prelu'
)
verify_mxnet_frontend_impl
(
mx_sym
,
(
1
,
3
,
100
,
100
),
(
1
,
6
,
100
,
100
))
def
test_forward_softrelu
():
data
=
mx
.
sym
.
var
(
'data'
)
data
=
mx
.
sym
.
concat
(
data
,
-
data
,
dim
=
1
)
# negative part explicitly
...
...
@@ -126,6 +133,7 @@ if __name__ == '__main__':
test_forward_resnet
()
test_forward_elu
()
test_forward_rrelu
()
test_forward_prelu
()
test_forward_softrelu
()
test_forward_fc_flatten
()
test_forward_clip
()
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