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
fd6ad274
Commit
fd6ad274
authored
May 23, 2018
by
MORITA Kazutaka
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FRONTEND][Keras] Fix softmax axis (#503)
parent
8534db36
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
nnvm/python/nnvm/frontend/keras.py
+1
-1
nnvm/tests/python/frontend/keras/test_forward.py
+10
-0
No files found.
nnvm/python/nnvm/frontend/keras.py
View file @
fd6ad274
...
@@ -40,7 +40,7 @@ def _convert_activation(insym, keras_layer, _):
...
@@ -40,7 +40,7 @@ def _convert_activation(insym, keras_layer, _):
return
_sym
.
__add_scalar__
(
_sym
.
__mul_scalar__
(
insym
,
\
return
_sym
.
__add_scalar__
(
_sym
.
__mul_scalar__
(
insym
,
\
scalar
=
alpha
),
scalar
=
beta
)
scalar
=
alpha
),
scalar
=
beta
)
elif
act_type
==
'softmax'
:
elif
act_type
==
'softmax'
:
return
_sym
.
softmax
(
insym
)
return
_sym
.
softmax
(
insym
,
axis
=
1
)
elif
act_type
==
'sigmoid'
:
elif
act_type
==
'sigmoid'
:
return
_sym
.
sigmoid
(
insym
)
return
_sym
.
sigmoid
(
insym
)
elif
act_type
==
'tanh'
:
elif
act_type
==
'tanh'
:
...
...
nnvm/tests/python/frontend/keras/test_forward.py
View file @
fd6ad274
...
@@ -59,6 +59,15 @@ def test_forward_elemwise_add():
...
@@ -59,6 +59,15 @@ def test_forward_elemwise_add():
verify_keras_frontend
(
keras_model
)
verify_keras_frontend
(
keras_model
)
def
test_forward_softmax
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
Activation
(
'softmax'
)(
data
)
x
=
keras
.
layers
.
Concatenate
()([
x
,
x
])
x
=
keras
.
layers
.
GlobalMaxPooling2D
()(
x
)
keras_model
=
keras
.
models
.
Model
(
data
,
x
)
verify_keras_frontend
(
keras_model
)
def
test_forward_softrelu
():
def
test_forward_softrelu
():
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
data
=
keras
.
layers
.
Input
(
shape
=
(
32
,
32
,
3
))
x
=
keras
.
layers
.
Activation
(
'softplus'
)(
data
)
x
=
keras
.
layers
.
Activation
(
'softplus'
)(
data
)
...
@@ -145,6 +154,7 @@ def test_forward_resnet50():
...
@@ -145,6 +154,7 @@ def test_forward_resnet50():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_forward_elemwise_add
()
test_forward_elemwise_add
()
test_forward_softmax
()
test_forward_softrelu
()
test_forward_softrelu
()
test_forward_leaky_relu
()
test_forward_leaky_relu
()
test_forward_dense
()
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