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
8c5b4909
Commit
8c5b4909
authored
Mar 19, 2018
by
Yuwei Hu
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Keras] fix dropout bug (#399)
parent
b7b74228
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
15 deletions
+4
-15
nnvm/python/nnvm/frontend/keras.py
+1
-1
nnvm/tests/python/frontend/keras/test_forward.py
+3
-14
No files found.
nnvm/python/nnvm/frontend/keras.py
View file @
8c5b4909
...
...
@@ -355,7 +355,7 @@ def _convert_reshape(insym, keras_layer, _):
def
_default_skip
(
insym
,
keras_layer
,
_
):
# pylint: disable=unused-argument
"""Layers that can be skipped because they are train time only."""
return
return
insym
_convert_map
=
{
...
...
nnvm/tests/python/frontend/keras/test_forward.py
View file @
8c5b4909
...
...
@@ -40,7 +40,6 @@ def verify_keras_frontend(keras_model):
def
test_forward_elemwise_add
():
print
(
"test_forward_elemwise_add"
)
r
=
[]
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
Conv2D
(
8
,
(
3
,
3
),
padding
=
"same"
)(
data
)
...
...
@@ -48,28 +47,18 @@ def test_forward_elemwise_add():
x
=
keras
.
layers
.
Conv2D
(
8
,
(
3
,
3
),
padding
=
"same"
)(
x
)
r
.
append
(
x
)
x
=
keras
.
layers
.
Conv2D
(
8
,
(
3
,
3
),
padding
=
"same"
)(
x
)
# add two symbols
y
=
keras
.
layers
.
add
([
keras
.
layers
.
add
([
x
,
r
[
0
]]),
r
[
1
]])
y
=
keras
.
layers
.
GlobalAveragePooling2D
()(
y
)
keras_model
=
keras
.
models
.
Model
(
data
,
y
)
verify_keras_frontend
(
keras_model
)
# add three symbols
y
=
keras
.
layers
.
add
([
x
,
r
[
0
],
r
[
1
]])
y
=
keras
.
layers
.
GlobalAveragePooling2D
()(
y
)
keras_model
=
keras
.
models
.
Model
(
data
,
y
)
verify_keras_frontend
(
keras_model
)
def
test_forward_elementwise_add2
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
r
=
keras
.
layers
.
Conv2D
(
10
,
(
3
,
3
),
padding
=
"same"
)(
data
)
x
=
keras
.
layers
.
Conv2D
(
10
,
(
3
,
3
),
strides
=
(
2
,
2
),
padding
=
"same"
)(
data
)
x
=
keras
.
layers
.
UpSampling2D
()(
x
)
x
=
keras
.
layers
.
add
([
x
,
r
])
x
=
keras
.
layers
.
GlobalAveragePooling2D
()(
x
)
keras_model
=
keras
.
models
.
Model
(
data
,
x
)
def
test_forward_softrelu
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
Activation
(
'softplus'
)(
data
)
...
...
@@ -92,6 +81,7 @@ def test_forward_dense():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
MaxPooling2D
(
pool_size
=
(
2
,
2
))(
data
)
x
=
keras
.
layers
.
Flatten
()(
x
)
x
=
keras
.
layers
.
Dropout
(
0.5
)(
x
)
x
=
keras
.
layers
.
Dense
(
10
,
activation
=
'relu'
,
kernel_initializer
=
'uniform'
)(
x
)
keras_model
=
keras
.
models
.
Model
(
data
,
x
)
verify_keras_frontend
(
keras_model
)
...
...
@@ -146,7 +136,6 @@ def test_forward_resnet50():
if
__name__
==
'__main__'
:
test_forward_elemwise_add
()
test_forward_elementwise_add2
()
test_forward_softrelu
()
test_forward_leaky_relu
()
test_forward_dense
()
...
...
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