Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
67820feb
Commit
67820feb
authored
7 years ago
by
Joshua Z. Zhang
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix version comparison (#200)
parent
920d498d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nnvm/python/nnvm/frontend/mxnet.py
+10
-13
10 additions, 13 deletions
nnvm/python/nnvm/frontend/mxnet.py
with
10 additions
and
13 deletions
nnvm/python/nnvm/frontend/mxnet.py
+
10
−
13
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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment