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
67820feb
Commit
67820feb
authored
Oct 25, 2017
by
Joshua Z. Zhang
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix version comparison (#200)
parent
920d498d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
nnvm/python/nnvm/frontend/mxnet.py
+10
-13
No files found.
nnvm/python/nnvm/frontend/mxnet.py
View file @
67820feb
...
...
@@ -13,14 +13,6 @@ def _get_nnvm_op(op_name):
raise
RuntimeError
(
"Unable to map op_name {} to nnvm.sym"
.
format
(
op_name
))
return
op
def
_get_mxnet_version
():
try
:
import
mxnet
as
mx
version
=
mx
.
__version__
except
ImportError
:
version
=
'0.11.1'
return
[
int
(
x
)
for
x
in
version
.
split
(
'.'
)]
def
_required_attr
(
attr
,
key
):
assert
isinstance
(
attr
,
dict
)
if
key
not
in
attr
:
...
...
@@ -127,14 +119,19 @@ def _conv2d_transpose(inputs, attrs):
return
_get_nnvm_op
(
op_name
)(
*
inputs
,
**
new_attrs
)
def
_dense
(
inputs
,
attrs
):
import
mxnet
as
mx
op_name
,
new_attrs
=
'dense'
,
{}
new_attrs
[
'units'
]
=
_required_attr
(
attrs
,
'num_hidden'
)
new_attrs
[
'use_bias'
]
=
not
_parse_bool_str
(
attrs
,
'no_bias'
)
major
,
minor
,
micro
=
_get_mxnet_version
()
if
major
>=
0
and
minor
>=
11
and
micro
>=
1
:
use_flatten
=
_parse_bool_str
(
attrs
,
'flatten'
,
'True'
)
if
use_flatten
:
inputs
[
0
]
=
_sym
.
flatten
(
inputs
[
0
])
try
:
_
=
mx
.
sym
.
FullyConnected
(
mx
.
sym
.
var
(
'x'
),
num_hidden
=
1
,
flatten
=
True
)
has_flatten
=
True
except
mx
.
base
.
MXNetError
:
# no flatten attribute in old mxnet
has_flatten
=
False
use_flatten
=
_parse_bool_str
(
attrs
,
'flatten'
,
'True'
)
if
has_flatten
and
use_flatten
:
inputs
[
0
]
=
_sym
.
flatten
(
inputs
[
0
])
return
_get_nnvm_op
(
op_name
)(
*
inputs
,
**
new_attrs
)
def
_dropout
(
inputs
,
attrs
):
...
...
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