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
72efb427
"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "0159c3c11dfcdcadbd91ff5323de27d1c908356c"
Commit
72efb427
authored
Nov 09, 2018
by
Gan Quan
Committed by
Minjie Wang
Nov 09, 2018
Browse files
[Bugfix] fixes NLTK dependency (#125) and #126 (#131)
parent
aa568358
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
python/dgl/__init__.py
python/dgl/__init__.py
+2
-1
python/dgl/utils.py
python/dgl/utils.py
+4
-1
tests/pytorch/test_basics.py
tests/pytorch/test_basics.py
+7
-2
No files found.
python/dgl/__init__.py
View file @
72efb427
from
.
import
backend
from
.
import
backend
from
.
import
data
# One has to manually import dgl.data; fixes #125
#from . import data
from
.
import
function
from
.
import
function
from
.
import
nn
from
.
import
nn
...
...
python/dgl/utils.py
View file @
72efb427
...
@@ -37,7 +37,10 @@ class Index(object):
...
@@ -37,7 +37,10 @@ class Index(object):
self
.
_list_data
=
np
.
array
([
int
(
data
)]).
astype
(
np
.
int64
)
self
.
_list_data
=
np
.
array
([
int
(
data
)]).
astype
(
np
.
int64
)
except
:
except
:
try
:
try
:
self
.
_list_data
=
np
.
array
(
data
).
astype
(
np
.
int64
)
data
=
np
.
array
(
data
).
astype
(
'int64'
)
if
data
.
ndim
!=
1
:
raise
ValueError
(
'Index data must be 1D int64 vector, but got: %s'
%
str
(
data
))
self
.
_list_data
=
data
except
:
except
:
raise
ValueError
(
'Error index data: %s'
%
str
(
data
))
raise
ValueError
(
'Error index data: %s'
%
str
(
data
))
self
.
_user_tensor_data
[
F
.
cpu
()]
=
F
.
zerocopy_from_numpy
(
self
.
_list_data
)
self
.
_user_tensor_data
[
F
.
cpu
()]
=
F
.
zerocopy_from_numpy
(
self
.
_list_data
)
...
...
tests/pytorch/test_basics.py
View file @
72efb427
...
@@ -191,11 +191,16 @@ def test_update_routines():
...
@@ -191,11 +191,16 @@ def test_update_routines():
# send_and_recv
# send_and_recv
reduce_msg_shapes
.
clear
()
reduce_msg_shapes
.
clear
()
u
=
th
.
tensor
(
[
0
,
0
,
0
,
4
,
5
,
6
]
)
u
=
[
0
,
0
,
0
,
4
,
5
,
6
]
v
=
th
.
tensor
(
[
1
,
2
,
3
,
9
,
9
,
9
]
)
v
=
[
1
,
2
,
3
,
9
,
9
,
9
]
g
.
send_and_recv
((
u
,
v
))
g
.
send_and_recv
((
u
,
v
))
assert
(
reduce_msg_shapes
==
{(
1
,
3
,
D
),
(
3
,
1
,
D
)})
assert
(
reduce_msg_shapes
==
{(
1
,
3
,
D
),
(
3
,
1
,
D
)})
reduce_msg_shapes
.
clear
()
reduce_msg_shapes
.
clear
()
try
:
g
.
send_and_recv
([
u
,
v
])
assert
False
except
ValueError
:
pass
# pull
# pull
v
=
th
.
tensor
([
1
,
2
,
3
,
9
])
v
=
th
.
tensor
([
1
,
2
,
3
,
9
])
...
...
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