Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
ce34ae16
Commit
ce34ae16
authored
6 years ago
by
Pariksheet Pinjari
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[NNVM] Elu support added in darknet frontend (#1199)
parent
5f7f4138
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nnvm/python/nnvm/frontend/darknet.py
+4
-0
4 additions, 0 deletions
nnvm/python/nnvm/frontend/darknet.py
nnvm/tests/python/frontend/darknet/test_forward.py
+13
-1
13 additions, 1 deletion
nnvm/tests/python/frontend/darknet/test_forward.py
with
17 additions
and
1 deletion
nnvm/python/nnvm/frontend/darknet.py
+
4
−
0
View file @
ce34ae16
...
@@ -302,6 +302,8 @@ def _darknet_activations(inputs, attrs):
...
@@ -302,6 +302,8 @@ def _darknet_activations(inputs, attrs):
return
inputs
,
None
return
inputs
,
None
elif
ACTIVATION
.
LEAKY
==
act
:
elif
ACTIVATION
.
LEAKY
==
act
:
act_type
=
'
leaky_relu
'
act_type
=
'
leaky_relu
'
elif
ACTIVATION
.
ELU
==
act
:
act_type
=
'
elu
'
else
:
else
:
_darknet_raise_not_supported
(
'
act:
'
+
act
)
_darknet_raise_not_supported
(
'
act:
'
+
act
)
...
@@ -312,6 +314,8 @@ def _darknet_activations(inputs, attrs):
...
@@ -312,6 +314,8 @@ def _darknet_activations(inputs, attrs):
op_name
,
new_attrs
=
act_type
,
{}
op_name
,
new_attrs
=
act_type
,
{}
new_attrs
[
'
alpha
'
]
=
attrs
.
get
(
'
slope
'
,
0.1
)
new_attrs
[
'
alpha
'
]
=
attrs
.
get
(
'
slope
'
,
0.1
)
sym
=
_darknet_get_nnvm_op
(
op_name
)(
*
inputs
,
**
new_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
)
else
:
else
:
_darknet_raise_not_supported
(
'
act_type:
'
+
act_type
)
_darknet_raise_not_supported
(
'
act_type:
'
+
act_type
)
return
sym
,
None
return
sym
,
None
...
...
This diff is collapsed.
Click to expand it.
nnvm/tests/python/frontend/darknet/test_forward.py
+
13
−
1
View file @
ce34ae16
...
@@ -138,7 +138,7 @@ def test_forward_resnet50():
...
@@ -138,7 +138,7 @@ def test_forward_resnet50():
def
test_forward_yolo
():
def
test_forward_yolo
():
'''
test yolo model
'''
'''
test yolo model
'''
model_name
=
'
yolo
'
model_name
=
'
yolo
v2
'
cfg_name
=
model_name
+
'
.cfg
'
cfg_name
=
model_name
+
'
.cfg
'
weights_name
=
model_name
+
'
.weights
'
weights_name
=
model_name
+
'
.weights
'
cfg_url
=
'
https://github.com/pjreddie/darknet/blob/master/cfg/
'
+
cfg_name
+
'
?raw=true
'
cfg_url
=
'
https://github.com/pjreddie/darknet/blob/master/cfg/
'
+
cfg_name
+
'
?raw=true
'
...
@@ -242,6 +242,17 @@ def test_forward_region():
...
@@ -242,6 +242,17 @@ def test_forward_region():
test_forward
(
net
)
test_forward
(
net
)
LIB
.
free_network
(
net
)
LIB
.
free_network
(
net
)
def
test_forward_elu
():
'''
test elu activation layer
'''
net
=
LIB
.
make_network
(
1
)
layer_1
=
LIB
.
make_convolutional_layer
(
1
,
224
,
224
,
3
,
32
,
1
,
3
,
2
,
0
,
1
,
0
,
0
,
0
,
0
)
layer_1
.
activation
=
8
net
.
layers
[
0
]
=
layer_1
net
.
w
=
net
.
h
=
224
LIB
.
resize_network
(
net
,
224
,
224
)
test_forward
(
net
)
LIB
.
free_network
(
net
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
test_forward_resnet50
()
test_forward_resnet50
()
test_forward_alexnet
()
test_forward_alexnet
()
...
@@ -255,3 +266,4 @@ if __name__ == '__main__':
...
@@ -255,3 +266,4 @@ if __name__ == '__main__':
test_forward_dense
()
test_forward_dense
()
test_forward_reorg
()
test_forward_reorg
()
test_forward_region
()
test_forward_region
()
test_forward_elu
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment