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
2dea4297
Commit
2dea4297
authored
Sep 10, 2018
by
Yuwei Hu
Committed by
Tianqi Chen
Sep 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TEST][Keras] use pretrained model to avoid small error caused by random weights (#1701)
parent
b27a9a7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
nnvm/python/nnvm/frontend/keras.py
+2
-0
nnvm/tests/python/frontend/keras/test_forward.py
+5
-4
No files found.
nnvm/python/nnvm/frontend/keras.py
View file @
2dea4297
...
...
@@ -75,6 +75,8 @@ def _convert_activation(insym, keras_layer, _):
def
_convert_advanced_activation
(
insym
,
keras_layer
,
symtab
):
act_type
=
type
(
keras_layer
)
.
__name__
if
act_type
==
'ReLU'
:
if
keras_layer
.
max_value
:
return
_sym
.
clip
(
insym
,
a_min
=
0
,
a_max
=
keras_layer
.
max_value
)
return
_sym
.
relu
(
insym
)
elif
act_type
==
'LeakyReLU'
:
return
_sym
.
leaky_relu
(
insym
,
alpha
=
keras_layer
.
alpha
)
...
...
nnvm/tests/python/frontend/keras/test_forward.py
View file @
2dea4297
...
...
@@ -141,25 +141,25 @@ def test_forward_crop():
def
test_forward_vgg16
():
keras_model
=
keras
.
applications
.
vgg16
.
VGG16
(
include_top
=
True
,
weights
=
None
,
keras_model
=
keras
.
applications
.
vgg16
.
VGG16
(
include_top
=
True
,
weights
=
'imagenet'
,
input_shape
=
(
224
,
224
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
def
test_forward_xception
():
keras_model
=
keras
.
applications
.
xception
.
Xception
(
include_top
=
True
,
weights
=
None
,
keras_model
=
keras
.
applications
.
xception
.
Xception
(
include_top
=
True
,
weights
=
'imagenet'
,
input_shape
=
(
299
,
299
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
def
test_forward_resnet50
():
keras_model
=
keras
.
applications
.
resnet50
.
ResNet50
(
include_top
=
True
,
weights
=
None
,
keras_model
=
keras
.
applications
.
resnet50
.
ResNet50
(
include_top
=
True
,
weights
=
'imagenet'
,
input_shape
=
(
224
,
224
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
def
test_forward_mobilenet
():
keras_model
=
keras
.
applications
.
mobilenet
.
MobileNet
(
include_top
=
True
,
weights
=
None
,
keras_model
=
keras
.
applications
.
mobilenet
.
MobileNet
(
include_top
=
True
,
weights
=
'imagenet'
,
input_shape
=
(
224
,
224
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
...
...
@@ -169,6 +169,7 @@ def test_forward_activations():
act_funcs
=
[
keras
.
layers
.
Activation
(
'softmax'
),
keras
.
layers
.
Activation
(
'softplus'
),
keras
.
layers
.
ReLU
(),
keras
.
layers
.
ReLU
(
max_value
=
6.
),
keras
.
layers
.
LeakyReLU
(
alpha
=
0.3
),
keras
.
layers
.
PReLU
(
weights
=
weights
,
alpha_initializer
=
"zero"
),
keras
.
layers
.
ELU
(
alpha
=
0.5
),
...
...
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