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
bdaccc82
Unverified
Commit
bdaccc82
authored
May 23, 2022
by
Mufei Li
Committed by
GitHub
May 23, 2022
Browse files
[Bug Fix] Fix KeyError for rgcn-hetero Entity Classification w/ minibatch training (#4022)
* Update model.py * Update entity_classify_mb.py
parent
d70a362d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
examples/pytorch/rgcn-hetero/entity_classify_mb.py
examples/pytorch/rgcn-hetero/entity_classify_mb.py
+1
-1
examples/pytorch/rgcn-hetero/model.py
examples/pytorch/rgcn-hetero/model.py
+1
-1
No files found.
examples/pytorch/rgcn-hetero/entity_classify_mb.py
View file @
bdaccc82
...
...
@@ -152,7 +152,7 @@ def main(args):
output
=
model
.
inference
(
g
,
args
.
batch_size
,
'cuda'
if
use_cuda
else
'cpu'
,
0
,
node_embed
)
test_pred
=
output
[
category
][
test_idx
]
test_labels
=
labels
[
test_idx
]
test_labels
=
labels
[
test_idx
]
.
to
(
test_pred
.
device
)
test_acc
=
(
test_pred
.
argmax
(
1
)
==
test_labels
).
float
().
mean
()
print
(
"Test Acc: {:.4f}"
.
format
(
test_acc
))
print
()
...
...
examples/pytorch/rgcn-hetero/model.py
View file @
bdaccc82
...
...
@@ -365,7 +365,7 @@ class EntityClassify(nn.Module):
h
=
{
k
:
x
[
k
][
input_nodes
[
k
]].
to
(
device
)
for
k
in
input_nodes
.
keys
()}
h
=
layer
(
block
,
h
)
for
k
in
h
.
keys
():
for
k
in
output_nodes
.
keys
():
y
[
k
][
output_nodes
[
k
]]
=
h
[
k
].
cpu
()
x
=
y
...
...
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