"tests/python/pytorch/sparse/test_reduction.py" did not exist on "9169fc35414f7da16e2449ef2f7ec57b91fbd8a6"
Unverified Commit 6efd2ca1 authored by Rhett Ying's avatar Rhett Ying Committed by GitHub
Browse files

[GraphBolt] use type instead of type_name to be unified (#5981)

parent 25217dc6
...@@ -49,17 +49,17 @@ class OnDiskDataset(Dataset): ...@@ -49,17 +49,17 @@ class OnDiskDataset(Dataset):
in_memory: false in_memory: false
path: edge_data/author-writes-paper-feat.npy path: edge_data/author-writes-paper-feat.npy
train_sets: train_sets:
- - type_name: paper # could be null for homogeneous graph. - - type: paper # could be null for homogeneous graph.
format: numpy format: numpy
in_memory: true # If not specified, default to true. in_memory: true # If not specified, default to true.
path: set/paper-train.npy path: set/paper-train.npy
validation_sets: validation_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
in_memory: true in_memory: true
path: set/paper-validation.npy path: set/paper-validation.npy
test_sets: test_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
in_memory: true in_memory: true
path: set/paper-test.npy path: set/paper-test.npy
...@@ -139,10 +139,10 @@ class OnDiskDataset(Dataset): ...@@ -139,10 +139,10 @@ class OnDiskDataset(Dataset):
for tvt_set in tvt_sets: for tvt_set in tvt_sets:
if (tvt_set is None) or (len(tvt_set) == 0): if (tvt_set is None) or (len(tvt_set) == 0):
ret.append(None) ret.append(None)
if tvt_set[0].type_name is None: if tvt_set[0].type is None:
assert ( assert (
len(tvt_set) == 1 len(tvt_set) == 1
), "Only one TVT set is allowed if type_name is not specified." ), "Only one TVT set is allowed if type is not specified."
data = read_data( data = read_data(
tvt_set[0].path, tvt_set[0].format, tvt_set[0].in_memory tvt_set[0].path, tvt_set[0].format, tvt_set[0].in_memory
) )
...@@ -150,7 +150,7 @@ class OnDiskDataset(Dataset): ...@@ -150,7 +150,7 @@ class OnDiskDataset(Dataset):
else: else:
data = {} data = {}
for tvt in tvt_set: for tvt in tvt_set:
data[tvt.type_name] = ItemSet( data[tvt.type] = ItemSet(
tensor_to_tuple( tensor_to_tuple(
read_data(tvt.path, tvt.format, tvt.in_memory) read_data(tvt.path, tvt.format, tvt.in_memory)
) )
......
...@@ -27,7 +27,7 @@ class OnDiskFeatureDataFormat(pydantic_yaml.YamlStrEnum): ...@@ -27,7 +27,7 @@ class OnDiskFeatureDataFormat(pydantic_yaml.YamlStrEnum):
class OnDiskTVTSet(pydantic.BaseModel): class OnDiskTVTSet(pydantic.BaseModel):
"""Train-Validation-Test set.""" """Train-Validation-Test set."""
type_name: Optional[str] type: Optional[str]
format: OnDiskFeatureDataFormat format: OnDiskFeatureDataFormat
in_memory: Optional[bool] = True in_memory: Optional[bool] = True
path: str path: str
......
...@@ -19,7 +19,7 @@ def test_OnDiskDataset_TVTSet_exceptions(): ...@@ -19,7 +19,7 @@ def test_OnDiskDataset_TVTSet_exceptions():
# Case 1: ``format`` is invalid. # Case 1: ``format`` is invalid.
yaml_content = """ yaml_content = """
train_sets: train_sets:
- - type_name: paper - - type: paper
format: torch_invalid format: torch_invalid
path: set/paper-train.pt path: set/paper-train.pt
""" """
...@@ -29,13 +29,13 @@ def test_OnDiskDataset_TVTSet_exceptions(): ...@@ -29,13 +29,13 @@ def test_OnDiskDataset_TVTSet_exceptions():
with pytest.raises(pydantic.ValidationError): with pytest.raises(pydantic.ValidationError):
_ = gb.OnDiskDataset(yaml_file) _ = gb.OnDiskDataset(yaml_file)
# Case 2: ``type_name`` is not specified while multiple TVT sets are specified. # Case 2: ``type`` is not specified while multiple TVT sets are specified.
yaml_content = """ yaml_content = """
train_sets: train_sets:
- - type_name: null - - type: null
format: numpy format: numpy
path: set/train.npy path: set/train.npy
- type_name: null - type: null
format: numpy format: numpy
path: set/train.npy path: set/train.npy
""" """
...@@ -43,7 +43,7 @@ def test_OnDiskDataset_TVTSet_exceptions(): ...@@ -43,7 +43,7 @@ def test_OnDiskDataset_TVTSet_exceptions():
f.write(yaml_content) f.write(yaml_content)
with pytest.raises( with pytest.raises(
AssertionError, AssertionError,
match=r"Only one TVT set is allowed if type_name is not specified.", match=r"Only one TVT set is allowed if type is not specified.",
): ):
_ = gb.OnDiskDataset(yaml_file) _ = gb.OnDiskDataset(yaml_file)
...@@ -71,29 +71,29 @@ def test_OnDiskDataset_TVTSet_ItemSet_id_label(): ...@@ -71,29 +71,29 @@ def test_OnDiskDataset_TVTSet_ItemSet_id_label():
# Case 1: # Case 1:
# all TVT sets are specified. # all TVT sets are specified.
# ``type_name`` is not specified or specified as ``null``. # ``type`` is not specified or specified as ``null``.
# ``in_memory`` could be ``true`` and ``false``. # ``in_memory`` could be ``true`` and ``false``.
yaml_content = f""" yaml_content = f"""
train_sets: train_sets:
- - type_name: null - - type: null
format: numpy format: numpy
in_memory: true in_memory: true
path: {train_path} path: {train_path}
- - type_name: null - - type: null
format: numpy format: numpy
path: {train_path} path: {train_path}
validation_sets: validation_sets:
- - format: numpy - - format: numpy
path: {validation_path} path: {validation_path}
- - type_name: null - - type: null
format: numpy format: numpy
path: {validation_path} path: {validation_path}
test_sets: test_sets:
- - type_name: null - - type: null
format: numpy format: numpy
in_memory: false in_memory: false
path: {test_path} path: {test_path}
- - type_name: null - - type: null
format: numpy format: numpy
path: {test_path} path: {test_path}
""" """
...@@ -140,7 +140,7 @@ def test_OnDiskDataset_TVTSet_ItemSet_id_label(): ...@@ -140,7 +140,7 @@ def test_OnDiskDataset_TVTSet_ItemSet_id_label():
# Case 2: Some TVT sets are None. # Case 2: Some TVT sets are None.
yaml_content = f""" yaml_content = f"""
train_sets: train_sets:
- - type_name: null - - type: null
format: numpy format: numpy
path: {train_path} path: {train_path}
""" """
...@@ -178,25 +178,25 @@ def test_OnDiskDataset_TVTSet_ItemSet_node_pair_label(): ...@@ -178,25 +178,25 @@ def test_OnDiskDataset_TVTSet_ItemSet_node_pair_label():
yaml_content = f""" yaml_content = f"""
train_sets: train_sets:
- - type_name: null - - type: null
format: numpy format: numpy
in_memory: true in_memory: true
path: {train_path} path: {train_path}
- - type_name: null - - type: null
format: numpy format: numpy
path: {train_path} path: {train_path}
validation_sets: validation_sets:
- - format: numpy - - format: numpy
path: {validation_path} path: {validation_path}
- - type_name: null - - type: null
format: numpy format: numpy
path: {validation_path} path: {validation_path}
test_sets: test_sets:
- - type_name: null - - type: null
format: numpy format: numpy
in_memory: false in_memory: false
path: {test_path} path: {test_path}
- - type_name: null - - type: null
format: numpy format: numpy
path: {test_path} path: {test_path}
""" """
...@@ -267,26 +267,26 @@ def test_OnDiskDataset_TVTSet_ItemSetDict_id_label(): ...@@ -267,26 +267,26 @@ def test_OnDiskDataset_TVTSet_ItemSetDict_id_label():
yaml_content = f""" yaml_content = f"""
train_sets: train_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
in_memory: true in_memory: true
path: {train_path} path: {train_path}
- - type_name: author - - type: author
format: numpy format: numpy
path: {train_path} path: {train_path}
validation_sets: validation_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
path: {validation_path} path: {validation_path}
- - type_name: author - - type: author
format: numpy format: numpy
path: {validation_path} path: {validation_path}
test_sets: test_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
in_memory: false in_memory: false
path: {test_path} path: {test_path}
- - type_name: author - - type: author
format: numpy format: numpy
path: {test_path} path: {test_path}
""" """
...@@ -369,26 +369,26 @@ def test_OnDiskDataset_TVTSet_ItemSetDict_node_pair_label(): ...@@ -369,26 +369,26 @@ def test_OnDiskDataset_TVTSet_ItemSetDict_node_pair_label():
yaml_content = f""" yaml_content = f"""
train_sets: train_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
in_memory: true in_memory: true
path: {train_path} path: {train_path}
- - type_name: author - - type: author
format: numpy format: numpy
path: {train_path} path: {train_path}
validation_sets: validation_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
path: {validation_path} path: {validation_path}
- - type_name: author - - type: author
format: numpy format: numpy
path: {validation_path} path: {validation_path}
test_sets: test_sets:
- - type_name: paper - - type: paper
format: numpy format: numpy
in_memory: false in_memory: false
path: {test_path} path: {test_path}
- - type_name: author - - type: author
format: numpy format: numpy
path: {test_path} path: {test_path}
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment