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
b569e4be
Unverified
Commit
b569e4be
authored
Feb 18, 2024
by
Mingbang Wang
Committed by
GitHub
Feb 18, 2024
Browse files
[Misc] Correct some typos (#7120)
parent
458b938c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
tests/python/pytorch/graphbolt/gb_test_utils.py
tests/python/pytorch/graphbolt/gb_test_utils.py
+13
-11
tests/python/pytorch/graphbolt/impl/test_ondisk_dataset.py
tests/python/pytorch/graphbolt/impl/test_ondisk_dataset.py
+1
-1
No files found.
tests/python/pytorch/graphbolt/gb_test_utils.py
View file @
b569e4be
...
@@ -98,11 +98,12 @@ def random_homo_graphbolt_graph(
...
@@ -98,11 +98,12 @@ def random_homo_graphbolt_graph(
)
)
edges
=
np
.
stack
([
nodes
,
neighbors
],
axis
=
1
)
edges
=
np
.
stack
([
nodes
,
neighbors
],
axis
=
1
)
os
.
makedirs
(
os
.
path
.
join
(
test_dir
,
"edges"
),
exist_ok
=
True
)
os
.
makedirs
(
os
.
path
.
join
(
test_dir
,
"edges"
),
exist_ok
=
True
)
assert
edge_fmt
in
[
"numpy"
,
"csv"
],
print
(
assert
edge_fmt
in
[
"only numpy and csv are supported for edges."
"numpy"
,
)
"csv"
,
],
"Only numpy and csv are supported for edges."
if
edge_fmt
==
"csv"
:
if
edge_fmt
==
"csv"
:
# Wr
t
ie into edges/edge.csv
# Wri
t
e into edges/edge.csv
edges_DataFrame
=
pd
.
DataFrame
(
edges
,
columns
=
[
"src"
,
"dst"
])
edges_DataFrame
=
pd
.
DataFrame
(
edges
,
columns
=
[
"src"
,
"dst"
])
edge_path
=
os
.
path
.
join
(
"edges"
,
"edge.csv"
)
edge_path
=
os
.
path
.
join
(
"edges"
,
"edge.csv"
)
edges_DataFrame
.
to_csv
(
edges_DataFrame
.
to_csv
(
...
@@ -111,7 +112,7 @@ def random_homo_graphbolt_graph(
...
@@ -111,7 +112,7 @@ def random_homo_graphbolt_graph(
header
=
False
,
header
=
False
,
)
)
else
:
else
:
# Wr
t
ie into edges/edge.npy
# Wri
t
e into edges/edge.npy
edges
=
edges
.
T
edges
=
edges
.
T
edge_path
=
os
.
path
.
join
(
"edges"
,
"edge.npy"
)
edge_path
=
os
.
path
.
join
(
"edges"
,
"edge.npy"
)
np
.
save
(
os
.
path
.
join
(
test_dir
,
edge_path
),
edges
)
np
.
save
(
os
.
path
.
join
(
test_dir
,
edge_path
),
edges
)
...
@@ -160,7 +161,7 @@ def random_homo_graphbolt_graph(
...
@@ -160,7 +161,7 @@ def random_homo_graphbolt_graph(
yaml_content
=
f
"""
yaml_content
=
f
"""
dataset_name:
{
dataset_name
}
dataset_name:
{
dataset_name
}
graph: #
g
raph structure and required attributes.
graph: #
G
raph structure and required attributes.
nodes:
nodes:
- num:
{
num_nodes
}
- num:
{
num_nodes
}
edges:
edges:
...
@@ -219,7 +220,7 @@ def random_homo_graphbolt_graph(
...
@@ -219,7 +220,7 @@ def random_homo_graphbolt_graph(
return
yaml_content
return
yaml_content
def
gener
e
ate_raw_data_for_hetero_dataset
(
def
generate_raw_data_for_hetero_dataset
(
test_dir
,
dataset_name
,
num_nodes
,
num_edges
,
num_classes
,
edge_fmt
=
"csv"
test_dir
,
dataset_name
,
num_nodes
,
num_edges
,
num_classes
,
edge_fmt
=
"csv"
):
):
# Generate edges.
# Generate edges.
...
@@ -229,9 +230,10 @@ def genereate_raw_data_for_hetero_dataset(
...
@@ -229,9 +230,10 @@ def genereate_raw_data_for_hetero_dataset(
src
=
torch
.
randint
(
0
,
num_nodes
[
src_ntype
],
(
num_edge
,))
src
=
torch
.
randint
(
0
,
num_nodes
[
src_ntype
],
(
num_edge
,))
dst
=
torch
.
randint
(
0
,
num_nodes
[
dst_ntype
],
(
num_edge
,))
dst
=
torch
.
randint
(
0
,
num_nodes
[
dst_ntype
],
(
num_edge
,))
os
.
makedirs
(
os
.
path
.
join
(
test_dir
,
"edges"
),
exist_ok
=
True
)
os
.
makedirs
(
os
.
path
.
join
(
test_dir
,
"edges"
),
exist_ok
=
True
)
assert
edge_fmt
in
[
"numpy"
,
"csv"
],
print
(
assert
edge_fmt
in
[
"only numpy and csv are supported for edges."
"numpy"
,
)
"csv"
,
],
"Only numpy and csv are supported for edges."
if
edge_fmt
==
"csv"
:
if
edge_fmt
==
"csv"
:
# Write into edges/edge.csv
# Write into edges/edge.csv
edges
=
pd
.
DataFrame
(
edges
=
pd
.
DataFrame
(
...
@@ -290,7 +292,7 @@ def genereate_raw_data_for_hetero_dataset(
...
@@ -290,7 +292,7 @@ def genereate_raw_data_for_hetero_dataset(
yaml_content
=
f
"""
yaml_content
=
f
"""
dataset_name:
{
dataset_name
}
dataset_name:
{
dataset_name
}
graph: #
g
raph structure and required attributes.
graph: #
G
raph structure and required attributes.
nodes:
nodes:
- type: user
- type: user
num:
{
num_nodes
[
"user"
]
}
num:
{
num_nodes
[
"user"
]
}
...
...
tests/python/pytorch/graphbolt/impl/test_ondisk_dataset.py
View file @
b569e4be
...
@@ -2713,7 +2713,7 @@ def test_OnDiskDataset_heterogeneous(include_original_edge_id, edge_fmt):
...
@@ -2713,7 +2713,7 @@ def test_OnDiskDataset_heterogeneous(include_original_edge_id, edge_fmt):
(
"user"
,
"click"
,
"item"
):
20000
,
(
"user"
,
"click"
,
"item"
):
20000
,
}
}
num_classes
=
10
num_classes
=
10
gbt
.
gener
e
ate_raw_data_for_hetero_dataset
(
gbt
.
generate_raw_data_for_hetero_dataset
(
test_dir
,
test_dir
,
dataset_name
,
dataset_name
,
num_nodes
,
num_nodes
,
...
...
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