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
f9ad1c80
Unverified
Commit
f9ad1c80
authored
Mar 14, 2020
by
Da Zheng
Committed by
GitHub
Mar 15, 2020
Browse files
fix. (#1358)
Co-authored-by:
Chao Ma
<
mctt90@gmail.com
>
parent
eb71c804
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
apps/kg/dataloader/sampler.py
apps/kg/dataloader/sampler.py
+2
-2
No files found.
apps/kg/dataloader/sampler.py
View file @
f9ad1c80
...
...
@@ -275,7 +275,7 @@ def ConstructGraph(edges, n_entities, args):
else
:
src
,
etype_id
,
dst
=
edges
coo
=
sp
.
sparse
.
coo_matrix
((
np
.
ones
(
len
(
src
)),
(
src
,
dst
)),
shape
=
[
n_entities
,
n_entities
])
g
=
dgl
.
DGLGraph
(
coo
,
readonly
=
True
,
sort_csr
=
True
)
g
=
dgl
.
DGLGraph
(
coo
,
readonly
=
True
,
multigraph
=
True
,
sort_csr
=
True
)
g
.
edata
[
'tid'
]
=
F
.
tensor
(
etype_id
,
F
.
int64
)
if
args
.
pickle_graph
:
with
open
(
os
.
path
.
join
(
args
.
data_path
,
args
.
dataset
,
pickle_name
),
'wb'
)
as
graph_file
:
...
...
@@ -562,7 +562,7 @@ class EvalDataset(object):
dst
=
np
.
concatenate
((
dataset
.
train
[
2
],
dataset
.
valid
[
2
],
dataset
.
test
[
2
]))
coo
=
sp
.
sparse
.
coo_matrix
((
np
.
ones
(
len
(
src
)),
(
src
,
dst
)),
shape
=
[
dataset
.
n_entities
,
dataset
.
n_entities
])
g
=
dgl
.
DGLGraph
(
coo
,
readonly
=
True
,
sort_csr
=
True
)
g
=
dgl
.
DGLGraph
(
coo
,
readonly
=
True
,
multigraph
=
True
,
sort_csr
=
True
)
g
.
edata
[
'tid'
]
=
F
.
tensor
(
etype_id
,
F
.
int64
)
if
args
.
pickle_graph
:
with
open
(
os
.
path
.
join
(
args
.
data_path
,
args
.
dataset
,
pickle_name
),
'wb'
)
as
graph_file
:
...
...
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