Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Misc] Correct some typos #7120

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions tests/python/pytorch/graphbolt/gb_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ def random_homo_graphbolt_graph(
)
edges = np.stack([nodes, neighbors], axis=1)
os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True)
assert edge_fmt in ["numpy", "csv"], print(
"only numpy and csv are supported for edges."
)
assert edge_fmt in [
"numpy",
"csv",
], "Only numpy and csv are supported for edges."
if edge_fmt == "csv":
# Wrtie into edges/edge.csv
# Write into edges/edge.csv
edges_DataFrame = pd.DataFrame(edges, columns=["src", "dst"])
edge_path = os.path.join("edges", "edge.csv")
edges_DataFrame.to_csv(
Expand All @@ -111,7 +112,7 @@ def random_homo_graphbolt_graph(
header=False,
)
else:
# Wrtie into edges/edge.npy
# Write into edges/edge.npy
edges = edges.T
edge_path = os.path.join("edges", "edge.npy")
np.save(os.path.join(test_dir, edge_path), edges)
Expand Down Expand Up @@ -160,7 +161,7 @@ def random_homo_graphbolt_graph(

yaml_content = f"""
dataset_name: {dataset_name}
graph: # graph structure and required attributes.
graph: # Graph structure and required attributes.
nodes:
- num: {num_nodes}
edges:
Expand Down Expand Up @@ -219,7 +220,7 @@ def random_homo_graphbolt_graph(
return yaml_content


def genereate_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"
):
# Generate edges.
Expand All @@ -229,9 +230,10 @@ def genereate_raw_data_for_hetero_dataset(
src = torch.randint(0, num_nodes[src_ntype], (num_edge,))
dst = torch.randint(0, num_nodes[dst_ntype], (num_edge,))
os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True)
assert edge_fmt in ["numpy", "csv"], print(
"only numpy and csv are supported for edges."
)
assert edge_fmt in [
"numpy",
"csv",
], "Only numpy and csv are supported for edges."
if edge_fmt == "csv":
# Write into edges/edge.csv
edges = pd.DataFrame(
Expand Down Expand Up @@ -290,7 +292,7 @@ def genereate_raw_data_for_hetero_dataset(

yaml_content = f"""
dataset_name: {dataset_name}
graph: # graph structure and required attributes.
graph: # Graph structure and required attributes.
nodes:
- type: user
num: {num_nodes["user"]}
Expand Down
2 changes: 1 addition & 1 deletion tests/python/pytorch/graphbolt/impl/test_ondisk_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ def test_OnDiskDataset_heterogeneous(include_original_edge_id, edge_fmt):
("user", "click", "item"): 20000,
}
num_classes = 10
gbt.genereate_raw_data_for_hetero_dataset(
gbt.generate_raw_data_for_hetero_dataset(
test_dir,
dataset_name,
num_nodes,
Expand Down
Loading