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
d626eab8
Commit
d626eab8
authored
Jan 16, 2018
by
Yuwei Hu
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CI] turn on keras frontend test (#309)
* [CI] turn on keras frontend test * fix * using tensorflow cpu version
parent
2374852e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
23 deletions
+33
-23
nnvm/python/nnvm/frontend/keras.py
+1
-3
nnvm/tests/python/frontend/keras/test_forward.py
+29
-20
nnvm/tests/scripts/task_frontend_test.sh
+3
-0
No files found.
nnvm/python/nnvm/frontend/keras.py
View file @
d626eab8
...
...
@@ -273,7 +273,6 @@ def _convert_pooling(insym, keras_layer, symtab):
def
_convert_upsample
(
insym
,
keras_layer
,
_
):
_check_data_format
(
keras_layer
)
upsample_type
=
type
(
keras_layer
)
.
__name__
if
upsample_type
==
"UpSampling1D"
:
h
=
keras_layer
.
size
params
=
{
'scale'
:
h
}
...
...
@@ -291,7 +290,6 @@ def _convert_upsample(insym, keras_layer, _):
params
=
{
'scale'
:
h
}
else
:
raise
TypeError
(
"Unsupported upsampling type : {}"
.
format
(
upsample_type
))
return
_sym
.
upsampling
(
insym
,
**
params
)
...
...
@@ -385,7 +383,7 @@ _convert_map = {
'Subtract'
:
_convert_merge
,
'Multiply'
:
_convert_merge
,
'ZeroPadding2D'
:
_convert_padding
,
'UpSampling2D'
:
_convert_upsample
,
'UpSampling2D'
:
_convert_upsample
,
# 'ZeroPadding1D' : _convert_padding,
# 'AveragePooling1D' : _convert_pooling,
...
...
nnvm/tests/python/frontend/keras/test_forward.py
View file @
d626eab8
...
...
@@ -39,7 +39,7 @@ def verify_keras_frontend(keras_model):
np
.
testing
.
assert_allclose
(
keras_out
,
tvm_out
,
rtol
=
1e-5
,
atol
=
1e-5
)
def
verify
_forward_softrelu
():
def
test
_forward_softrelu
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
Activation
(
'softplus'
)(
data
)
x
=
keras
.
layers
.
Concatenate
()([
x
,
x
])
...
...
@@ -48,7 +48,7 @@ def verify_forward_softrelu():
verify_keras_frontend
(
keras_model
)
def
verify
_forward_leaky_relu
():
def
test
_forward_leaky_relu
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
LeakyReLU
(
alpha
=
0.3
)(
data
)
x
=
keras
.
layers
.
Add
()([
x
,
x
])
...
...
@@ -57,7 +57,7 @@ def verify_forward_leaky_relu():
verify_keras_frontend
(
keras_model
)
def
verify
_forward_dense
():
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
)
...
...
@@ -66,7 +66,7 @@ def verify_forward_dense():
verify_keras_frontend
(
keras_model
)
def
verify
_forward_transpose_conv
():
def
test
_forward_transpose_conv
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
Conv2D
(
filters
=
10
,
kernel_size
=
(
3
,
3
),
strides
=
(
2
,
2
),
padding
=
'same'
)(
data
)
x
=
keras
.
applications
.
mobilenet
.
DepthwiseConv2D
(
kernel_size
=
(
3
,
3
),
padding
=
'same'
)(
x
)
...
...
@@ -76,7 +76,7 @@ def verify_forward_transpose_conv():
verify_keras_frontend
(
keras_model
)
def
verify
_forward_separable_conv
():
def
test
_forward_separable_conv
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
SeparableConv2D
(
filters
=
10
,
kernel_size
=
(
3
,
3
),
padding
=
'same'
,
activation
=
'relu'
)(
data
)
...
...
@@ -87,31 +87,40 @@ def verify_forward_separable_conv():
verify_keras_frontend
(
keras_model
)
def
verify_forward_vgg16
():
keras_model
=
keras
.
applications
.
vgg16
.
VGG16
(
include_top
=
True
,
weights
=
'imagenet'
,
def
test_forward_upsample
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
UpSampling2D
(
size
=
(
3
,
3
))(
data
)
x
=
keras
.
layers
.
GlobalAveragePooling2D
()(
x
)
keras_model
=
keras
.
models
.
Model
(
data
,
x
)
verify_keras_frontend
(
keras_model
)
def
test_forward_vgg16
():
keras_model
=
keras
.
applications
.
vgg16
.
VGG16
(
include_top
=
True
,
weights
=
None
,
input_shape
=
(
224
,
224
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
def
verify
_forward_xception
():
keras_model
=
keras
.
applications
.
xception
.
Xception
(
include_top
=
True
,
weights
=
'imagenet'
,
def
test
_forward_xception
():
keras_model
=
keras
.
applications
.
xception
.
Xception
(
include_top
=
True
,
weights
=
None
,
input_shape
=
(
299
,
299
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
def
verify
_forward_resnet50
():
keras_model
=
keras
.
applications
.
resnet50
.
ResNet50
(
include_top
=
True
,
weights
=
'imagenet'
,
def
test
_forward_resnet50
():
keras_model
=
keras
.
applications
.
resnet50
.
ResNet50
(
include_top
=
True
,
weights
=
None
,
input_shape
=
(
224
,
224
,
3
),
classes
=
1000
)
verify_keras_frontend
(
keras_model
)
if
__name__
==
'__main__'
:
verify_forward_softrelu
()
verify_forward_leaky_relu
()
verify_forward_dense
()
verify_forward_transpose_conv
()
verify_forward_separable_conv
()
verify_forward_vgg16
()
verify_forward_xception
()
verify_forward_resnet50
()
test_forward_softrelu
()
test_forward_leaky_relu
()
test_forward_dense
()
test_forward_transpose_conv
()
test_forward_separable_conv
()
test_forward_upsample
()
test_forward_vgg16
()
test_forward_xception
()
test_forward_resnet50
()
nnvm/tests/scripts/task_frontend_test.sh
View file @
d626eab8
...
...
@@ -7,3 +7,6 @@ python -m nose -v tests/python/frontend/onnx || exit -1
echo
"Running MXNet frontend test..."
python
-m
nose
-v
tests/python/frontend/mxnet
||
exit
-1
echo
"Running Keras frontend test..."
python
-m
nose
-v
tests/python/frontend/keras
||
exit
-1
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