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
b05cb84a
Unverified
Commit
b05cb84a
authored
Feb 24, 2020
by
Quan (Andy) Gan
Committed by
GitHub
Feb 24, 2020
Browse files
[BUG] Fixes #1262 (#1286)
parent
ddf8c858
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
examples/pytorch/rgcn/entity_classify.py
examples/pytorch/rgcn/entity_classify.py
+3
-3
examples/pytorch/rgcn/utils.py
examples/pytorch/rgcn/utils.py
+1
-1
No files found.
examples/pytorch/rgcn/entity_classify.py
View file @
b05cb84a
...
@@ -63,9 +63,9 @@ def main(args):
...
@@ -63,9 +63,9 @@ def main(args):
feats
=
torch
.
arange
(
num_nodes
)
feats
=
torch
.
arange
(
num_nodes
)
# edge type and normalization factor
# edge type and normalization factor
edge_type
=
torch
.
from_numpy
(
data
.
edge_type
)
edge_type
=
torch
.
from_numpy
(
data
.
edge_type
)
.
long
()
edge_norm
=
torch
.
from_numpy
(
data
.
edge_norm
).
unsqueeze
(
1
)
edge_norm
=
torch
.
from_numpy
(
data
.
edge_norm
).
unsqueeze
(
1
)
.
long
()
labels
=
torch
.
from_numpy
(
labels
).
view
(
-
1
)
labels
=
torch
.
from_numpy
(
labels
).
view
(
-
1
)
.
long
()
# check cuda
# check cuda
use_cuda
=
args
.
gpu
>=
0
and
torch
.
cuda
.
is_available
()
use_cuda
=
args
.
gpu
>=
0
and
torch
.
cuda
.
is_available
()
...
...
examples/pytorch/rgcn/utils.py
View file @
b05cb84a
...
@@ -141,7 +141,7 @@ def build_graph_from_triplets(num_nodes, num_rels, triplets):
...
@@ -141,7 +141,7 @@ def build_graph_from_triplets(num_nodes, num_rels, triplets):
g
.
add_edges
(
src
,
dst
)
g
.
add_edges
(
src
,
dst
)
norm
=
comp_deg_norm
(
g
)
norm
=
comp_deg_norm
(
g
)
print
(
"# nodes: {}, # edges: {}"
.
format
(
num_nodes
,
len
(
src
)))
print
(
"# nodes: {}, # edges: {}"
.
format
(
num_nodes
,
len
(
src
)))
return
g
,
rel
,
norm
return
g
,
rel
.
astype
(
'int64'
),
norm
.
astype
(
'int64'
)
def
build_test_graph
(
num_nodes
,
num_rels
,
edges
):
def
build_test_graph
(
num_nodes
,
num_rels
,
edges
):
src
,
rel
,
dst
=
edges
.
transpose
()
src
,
rel
,
dst
=
edges
.
transpose
()
...
...
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