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
9836f78e
Unverified
Commit
9836f78e
authored
Feb 19, 2023
by
Hongzhi (Steve), Chen
Committed by
GitHub
Feb 19, 2023
Browse files
autoformat (#5322)
Co-authored-by:
Ubuntu
<
ubuntu@ip-172-31-28-63.ap-northeast-1.compute.internal
>
parent
704bcaf6
Changes
57
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
73 additions
and
71 deletions
+73
-71
benchmarks/benchmarks/api/bench_add_self_loop.py
benchmarks/benchmarks/api/bench_add_self_loop.py
+3
-3
benchmarks/benchmarks/api/bench_batch.py
benchmarks/benchmarks/api/bench_batch.py
+2
-2
benchmarks/benchmarks/api/bench_builtin_apply_edges.py
benchmarks/benchmarks/api/bench_builtin_apply_edges.py
+3
-3
benchmarks/benchmarks/api/bench_builtin_apply_edges_hetero.py
...hmarks/benchmarks/api/bench_builtin_apply_edges_hetero.py
+3
-3
benchmarks/benchmarks/api/bench_builtin_multi_update_all.py
benchmarks/benchmarks/api/bench_builtin_multi_update_all.py
+25
-23
benchmarks/benchmarks/api/bench_builtin_update_all_coo.py
benchmarks/benchmarks/api/bench_builtin_update_all_coo.py
+3
-3
benchmarks/benchmarks/api/bench_builtin_update_all_csc.py
benchmarks/benchmarks/api/bench_builtin_update_all_csc.py
+3
-3
benchmarks/benchmarks/api/bench_edge_ids.py
benchmarks/benchmarks/api/bench_edge_ids.py
+2
-2
benchmarks/benchmarks/api/bench_edge_subgraph.py
benchmarks/benchmarks/api/bench_edge_subgraph.py
+3
-3
benchmarks/benchmarks/api/bench_find_edges.py
benchmarks/benchmarks/api/bench_find_edges.py
+2
-2
benchmarks/benchmarks/api/bench_format_conversion.py
benchmarks/benchmarks/api/bench_format_conversion.py
+2
-2
benchmarks/benchmarks/api/bench_heterograph_construction.py
benchmarks/benchmarks/api/bench_heterograph_construction.py
+3
-3
benchmarks/benchmarks/api/bench_homograph_edge_construction.py
...marks/benchmarks/api/bench_homograph_edge_construction.py
+3
-3
benchmarks/benchmarks/api/bench_homograph_scipy_construction.py
...arks/benchmarks/api/bench_homograph_scipy_construction.py
+3
-3
benchmarks/benchmarks/api/bench_in_degrees.py
benchmarks/benchmarks/api/bench_in_degrees.py
+2
-2
benchmarks/benchmarks/api/bench_in_edges.py
benchmarks/benchmarks/api/bench_in_edges.py
+2
-2
benchmarks/benchmarks/api/bench_in_subgraph.py
benchmarks/benchmarks/api/bench_in_subgraph.py
+3
-3
benchmarks/benchmarks/api/bench_khop.py
benchmarks/benchmarks/api/bench_khop.py
+2
-2
benchmarks/benchmarks/api/bench_knn_graph.py
benchmarks/benchmarks/api/bench_knn_graph.py
+2
-2
benchmarks/benchmarks/api/bench_metis_partition.py
benchmarks/benchmarks/api/bench_metis_partition.py
+2
-2
No files found.
benchmarks/benchmarks/api/bench_add_self_loop.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_batch.py
View file @
9836f78e
import
time
import
time
import
torch
import
dgl
import
dgl
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_builtin_apply_edges.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_builtin_apply_edges_hetero.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_builtin_multi_update_all.py
View file @
9836f78e
import
time
import
time
import
dgl
import
dgl
import
torch
import
numpy
as
np
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
@
utils
.
benchmark
(
'
time
'
,
timeout
=
600
)
@
utils
.
benchmark
(
"
time
"
,
timeout
=
600
)
@
utils
.
parametrize
(
'
feat_size
'
,
[
32
,
128
,
512
])
@
utils
.
parametrize
(
"
feat_size
"
,
[
32
,
128
,
512
])
@
utils
.
parametrize
(
'
num_relations
'
,
[
5
,
50
,
500
])
@
utils
.
parametrize
(
"
num_relations
"
,
[
5
,
50
,
500
])
@
utils
.
parametrize
(
'
multi_reduce_type
'
,
[
"sum"
,
"stack"
])
@
utils
.
parametrize
(
"
multi_reduce_type
"
,
[
"sum"
,
"stack"
])
def
track_time
(
feat_size
,
num_relations
,
multi_reduce_type
):
def
track_time
(
feat_size
,
num_relations
,
multi_reduce_type
):
device
=
utils
.
get_bench_device
()
device
=
utils
.
get_bench_device
()
dd
=
{}
dd
=
{}
candidate_edges
=
[
dgl
.
data
.
CoraGraphDataset
(
verbose
=
False
)[
0
].
edges
(),
dgl
.
data
.
PubmedGraphDataset
(
verbose
=
False
)[
candidate_edges
=
[
0
].
edges
(),
dgl
.
data
.
CiteseerGraphDataset
(
verbose
=
False
)[
0
].
edges
()]
dgl
.
data
.
CoraGraphDataset
(
verbose
=
False
)[
0
].
edges
(),
dgl
.
data
.
PubmedGraphDataset
(
verbose
=
False
)[
0
].
edges
(),
dgl
.
data
.
CiteseerGraphDataset
(
verbose
=
False
)[
0
].
edges
(),
]
for
i
in
range
(
num_relations
):
for
i
in
range
(
num_relations
):
dd
[(
'n1'
,
'e_{}'
.
format
(
i
),
'n2'
)]
=
candidate_edges
[
i
%
dd
[(
"n1"
,
"e_{}"
.
format
(
i
),
"n2"
)]
=
candidate_edges
[
len
(
candidate_edges
)]
i
%
len
(
candidate_edges
)
]
graph
=
dgl
.
heterograph
(
dd
)
graph
=
dgl
.
heterograph
(
dd
)
graph
=
graph
.
to
(
device
)
graph
=
graph
.
to
(
device
)
graph
.
nodes
[
'n1'
].
data
[
'h'
]
=
torch
.
randn
(
graph
.
nodes
[
"n1"
].
data
[
"h"
]
=
torch
.
randn
(
(
graph
.
num_nodes
(
'n1'
),
feat_size
),
device
=
device
)
(
graph
.
num_nodes
(
"n1"
),
feat_size
),
device
=
device
graph
.
nodes
[
'n2'
].
data
[
'h'
]
=
torch
.
randn
(
)
(
graph
.
num_nodes
(
'n2'
),
feat_size
),
device
=
device
)
graph
.
nodes
[
"n2"
].
data
[
"h"
]
=
torch
.
randn
(
(
graph
.
num_nodes
(
"n2"
),
feat_size
),
device
=
device
)
# dry run
# dry run
update_dict
=
{}
update_dict
=
{}
for
i
in
range
(
num_relations
):
for
i
in
range
(
num_relations
):
update_dict
[
'e_{}'
.
format
(
i
)]
=
(
update_dict
[
"e_{}"
.
format
(
i
)]
=
(
fn
.
copy_u
(
"h"
,
"m"
),
fn
.
sum
(
"m"
,
"h"
))
fn
.
copy_u
(
'h'
,
'm'
),
fn
.
sum
(
'm'
,
'h'
))
graph
.
multi_update_all
(
update_dict
,
multi_reduce_type
)
graph
.
multi_update_all
(
update_dict
,
multi_reduce_type
)
# timing
# timing
with
utils
.
Timer
()
as
t
:
with
utils
.
Timer
()
as
t
:
for
i
in
range
(
3
):
for
i
in
range
(
3
):
graph
.
multi_update_all
(
graph
.
multi_update_all
(
update_dict
,
multi_reduce_type
)
update_dict
,
multi_reduce_type
)
return
t
.
elapsed_secs
/
3
return
t
.
elapsed_secs
/
3
benchmarks/benchmarks/api/bench_builtin_update_all_coo.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_builtin_update_all_csc.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_edge_ids.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_edge_subgraph.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_find_edges.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_format_conversion.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_heterograph_construction.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_homograph_edge_construction.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_homograph_scipy_construction.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_in_degrees.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_in_edges.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_in_subgraph.py
View file @
9836f78e
import
time
import
time
import
numpy
as
np
import
torch
import
dgl
import
dgl
import
dgl.function
as
fn
import
dgl.function
as
fn
import
numpy
as
np
import
torch
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_khop.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_knn_graph.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
benchmarks/benchmarks/api/bench_metis_partition.py
View file @
9836f78e
import
time
import
time
import
dgl
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
import
dgl
from
..
import
utils
from
..
import
utils
...
...
Prev
1
2
3
Next
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