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
744896e2
Unverified
Commit
744896e2
authored
May 23, 2022
by
Quan (Andy) Gan
Committed by
GitHub
May 23, 2022
Browse files
fix examples (#4016)
Co-authored-by:
Mufei Li
<
mufeili1996@gmail.com
>
parent
bdaccc82
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
examples/pytorch/graphsage/node_classification.py
examples/pytorch/graphsage/node_classification.py
+1
-1
examples/pytorch/tgn/dataloading.py
examples/pytorch/tgn/dataloading.py
+4
-4
No files found.
examples/pytorch/graphsage/node_classification.py
View file @
744896e2
...
...
@@ -127,6 +127,6 @@ model.eval()
with
torch
.
no_grad
():
pred
=
model
.
inference
(
graph
,
device
,
4096
,
0
,
'cpu'
)
pred
=
pred
[
test_idx
].
to
(
device
)
label
=
graph
.
ndata
[
'label'
][
test_idx
]
label
=
graph
.
ndata
[
'label'
][
test_idx
]
.
to
(
device
)
acc
=
MF
.
accuracy
(
pred
,
label
)
print
(
'Test acc:'
,
acc
.
item
())
examples/pytorch/tgn/dataloading.py
View file @
744896e2
...
...
@@ -3,7 +3,7 @@ import dgl
from
dgl._dataloading.dataloader
import
EdgeCollator
from
dgl._dataloading
import
BlockSampler
from
dgl._dataloading.pytorch
import
_pop_subgraph_storage
,
_pop_storages
from
dgl._dataloading.pytorch
import
_pop_subgraph_storage
,
_pop_storages
,
EdgeDataLoader
from
dgl.base
import
DGLError
from
functools
import
partial
...
...
@@ -234,7 +234,7 @@ class TemporalEdgeCollator(EdgeCollator):
return
result
class
TemporalEdgeDataLoader
(
dgl
.
dataloading
.
EdgeDataLoader
):
class
TemporalEdgeDataLoader
(
EdgeDataLoader
):
""" TemporalEdgeDataLoader is an iteratable object to generate blocks for temporal embedding
as well as pos and neg pair graph for memory update.
...
...
@@ -600,7 +600,7 @@ class FastTemporalEdgeCollator(EdgeCollator):
# "APAN: Asynchronous Propagation Attention Network for Real-time Temporal Graph Embedding"
# that will be appeared in SIGMOD 21, code repo https://github.com/WangXuhongCN/APAN
class
SimpleTemporalSampler
(
dgl
.
dataloading
.
BlockSampler
):
class
SimpleTemporalSampler
(
BlockSampler
):
'''
Simple Temporal Sampler just choose the edges that happen before the current timestamp, to build the subgraph of the corresponding nodes.
And then the sampler uses the simplest static graph neighborhood sampling methods.
...
...
@@ -637,7 +637,7 @@ class SimpleTemporalSampler(dgl.dataloading.BlockSampler):
return
frontier
class
SimpleTemporalEdgeCollator
(
dgl
.
dataloading
.
EdgeCollator
):
class
SimpleTemporalEdgeCollator
(
EdgeCollator
):
'''
Temporal Edge collator merge the edges specified by eid: items
...
...
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