Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
f1a8f926
Commit
f1a8f926
authored
Jan 20, 2020
by
Tong He
Committed by
Minjie Wang
Jan 20, 2020
Browse files
[Feature] Add environment variable to switch on/off MXNet set_np_shape (#1207)
* add env var * Trigger CI * simplification * add doc
parent
a00636a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
docs/source/install/backend.rst
docs/source/install/backend.rst
+5
-0
python/dgl/backend/mxnet/tensor.py
python/dgl/backend/mxnet/tensor.py
+2
-1
No files found.
docs/source/install/backend.rst
View file @
f1a8f926
...
...
@@ -21,6 +21,11 @@ MXNet uses uint32 as the default data type for integer tensors, which only suppo
size
smaller
than
2
^
32.
To
enable
large
graph
training
,
*
build
*
MXNet
with
``
USE_INT64_TENSOR_SIZE
=
1
``
flag
.
See
`
this
FAQ
<
https
://
mxnet
.
apache
.
org
/
api
/
faq
/
large_tensor_support
>`
_
for
more
information
.
MXNet
1.5
and
later
has
an
option
to
enable
Numpy
shape
mode
for
``
NDArray
``
objects
,
some
DGL
models
need
this
mode
to
be
enabled
to
run
correctly
.
However
,
this
mode
may
not
compatible
with
pretrained
model
parameters
with
this
mode
disabled
,
e
.
g
.
pretrained
models
from
GluonCV
and
GluonNLP
.
By
setting
``
DGL_MXNET_SET_NP_SHAPE
``,
users
can
switch
this
mode
on
or
off
.
Tensorflow
backend
------------------
...
...
python/dgl/backend/mxnet/tensor.py
View file @
f1a8f926
...
...
@@ -2,6 +2,7 @@ from __future__ import absolute_import
from
distutils.version
import
LooseVersion
import
os
import
numpy
as
np
import
mxnet
as
mx
import
mxnet.ndarray
as
nd
...
...
@@ -17,7 +18,7 @@ if MX_VERSION.version[0] == 1 and MX_VERSION.version[1] < 5:
# After MXNet 1.5, empty tensors aren't supprted by default.
# After we turn on the numpy compatible flag, MXNet supports empty NDArray.
mx
.
set_np_shape
(
True
)
mx
.
set_np_shape
(
bool
(
os
.
environ
.
get
(
'DGL_MXNET_SET_NP_SHAPE'
,
True
)
))
def
data_type_dict
():
return
{
'float16'
:
np
.
float16
,
...
...
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