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
55a08dec
Commit
55a08dec
authored
Jul 25, 2018
by
Siju
Committed by
Tianqi Chen
Jul 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NNVM][DARKNET]Logistic activation added (#1477)
parent
5846775f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
+35
-1
nnvm/python/nnvm/frontend/darknet.py
+6
-1
nnvm/tests/python/frontend/darknet/test_forward.py
+29
-0
No files found.
nnvm/python/nnvm/frontend/darknet.py
View file @
55a08dec
...
...
@@ -301,7 +301,9 @@ def _darknet_region(inputs, attrs):
def
_darknet_activations
(
inputs
,
attrs
):
"""Process the activation function."""
act
=
_darknet_required_attr
(
attrs
,
'activation'
)
if
ACTIVATION
.
RELU
==
act
:
if
ACTIVATION
.
LOGISTIC
==
act
:
act_type
=
'sigmoid'
elif
ACTIVATION
.
RELU
==
act
:
act_type
=
'relu'
elif
ACTIVATION
.
TANH
==
act
:
act_type
=
'tanh'
...
...
@@ -323,6 +325,9 @@ def _darknet_activations(inputs, attrs):
sym
=
_darknet_get_nnvm_op
(
op_name
)(
*
inputs
,
**
new_attrs
)
elif
act_type
in
[
'elu'
]:
sym
=
-
1
*
_sym
.
relu
(
1
-
_sym
.
exp
(
*
inputs
))
+
_sym
.
relu
(
*
inputs
)
elif
act_type
in
[
'sigmoid'
]:
op_name
,
new_attrs
=
act_type
,
{}
sym
=
_darknet_get_nnvm_op
(
op_name
)(
*
inputs
,
**
new_attrs
)
else
:
_darknet_raise_not_supported
(
'act_type: '
+
act_type
)
return
sym
,
None
...
...
nnvm/tests/python/frontend/darknet/test_forward.py
View file @
55a08dec
...
...
@@ -324,6 +324,32 @@ def test_forward_rnn():
test_rnn_forward
(
net
)
LIB
.
free_network
(
net
)
def
test_forward_activation_logistic
():
'''test logistic activation layer'''
net
=
LIB
.
make_network
(
1
)
batch
=
1
h
=
224
w
=
224
c
=
3
n
=
32
groups
=
1
size
=
3
stride
=
2
padding
=
0
activation
=
0
batch_normalize
=
0
binary
=
0
xnor
=
0
adam
=
0
layer_1
=
LIB
.
make_convolutional_layer
(
batch
,
h
,
w
,
c
,
n
,
groups
,
size
,
stride
,
padding
,
activation
,
batch_normalize
,
binary
,
xnor
,
adam
)
net
.
layers
[
0
]
=
layer_1
net
.
w
=
w
net
.
h
=
h
LIB
.
resize_network
(
net
,
net
.
w
,
net
.
h
)
test_forward
(
net
)
LIB
.
free_network
(
net
)
if
__name__
==
'__main__'
:
test_forward_resnet50
()
test_forward_alexnet
()
...
...
@@ -342,3 +368,5 @@ if __name__ == '__main__':
test_forward_reorg
()
test_forward_region
()
test_forward_elu
()
test_forward_rnn
()
test_forward_activation_logistic
()
\ No newline at end of file
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