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
303b00eb
Commit
303b00eb
authored
Jul 30, 2018
by
Siju
Committed by
Tianqi Chen
Jul 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C-RNN layer support is added (#1492)
parent
b65a13dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
nnvm/python/nnvm/frontend/darknet.py
+25
-0
nnvm/tests/python/frontend/darknet/test_forward.py
+27
-0
No files found.
nnvm/python/nnvm/frontend/darknet.py
View file @
303b00eb
...
@@ -673,6 +673,31 @@ class GraphProto(object):
...
@@ -673,6 +673,31 @@ class GraphProto(object):
self
.
_sym_array
[
layer_num
]
=
sym
self
.
_sym_array
[
layer_num
]
=
sym
processed
=
True
processed
=
True
elif
LAYERTYPE
.
CRNN
==
layer
.
type
:
attr
.
update
({
'n'
:
layer
.
n
})
attr
.
update
({
'batch'
:
layer
.
batch
})
attr
.
update
({
'num_hidden'
:
str
(
layer
.
outputs
)})
state
=
self
.
_get_rnn_state_buffer
(
layer
)
for
_
in
range
(
layer
.
steps
):
input_layer
=
layer
.
input_layer
sym
=
self
.
_get_darknet_rnn_attrs
(
input_layer
,
sym
)
self_layer
=
layer
.
self_layer
state
=
self
.
_get_darknet_rnn_attrs
(
self_layer
,
state
)
op_name
,
new_attrs
=
'elemwise_add'
,
{}
new_inputs
=
_as_list
([
sym
,
state
])
state
=
_darknet_get_nnvm_op
(
op_name
)(
*
new_inputs
,
**
new_attrs
)
self
.
_outs
.
append
(
state
)
output_layer
=
layer
.
output_layer
sym
=
self
.
_get_darknet_rnn_attrs
(
output_layer
,
state
)
self
.
_sym_array
[
layer_num
]
=
sym
processed
=
True
return
processed
,
sym
return
processed
,
sym
def
from_darknet
(
self
):
def
from_darknet
(
self
):
...
...
nnvm/tests/python/frontend/darknet/test_forward.py
View file @
303b00eb
...
@@ -324,6 +324,31 @@ def test_forward_rnn():
...
@@ -324,6 +324,31 @@ def test_forward_rnn():
test_rnn_forward
(
net
)
test_rnn_forward
(
net
)
LIB
.
free_network
(
net
)
LIB
.
free_network
(
net
)
def
test_forward_crnn
():
'''test softmax layer'''
net
=
LIB
.
make_network
(
1
)
batch
=
1
c
=
3
h
=
224
w
=
224
hidden_filters
=
c
output_filters
=
c
steps
=
1
activation
=
0
batch_normalize
=
0
inputs
=
256
outputs
=
256
layer_1
=
LIB
.
make_crnn_layer
(
batch
,
h
,
w
,
c
,
hidden_filters
,
output_filters
,
steps
,
activation
,
batch_normalize
)
net
.
layers
[
0
]
=
layer_1
net
.
inputs
=
inputs
net
.
outputs
=
output_filters
*
h
*
w
net
.
w
=
w
net
.
h
=
h
LIB
.
resize_network
(
net
,
net
.
w
,
net
.
h
)
test_forward
(
net
)
LIB
.
free_network
(
net
)
def
test_forward_activation_logistic
():
def
test_forward_activation_logistic
():
'''test logistic activation layer'''
'''test logistic activation layer'''
net
=
LIB
.
make_network
(
1
)
net
=
LIB
.
make_network
(
1
)
...
@@ -369,4 +394,5 @@ if __name__ == '__main__':
...
@@ -369,4 +394,5 @@ if __name__ == '__main__':
test_forward_region
()
test_forward_region
()
test_forward_elu
()
test_forward_elu
()
test_forward_rnn
()
test_forward_rnn
()
test_forward_crnn
()
test_forward_activation_logistic
()
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