Unverified Commit df1ea757 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Misc] Reorder the variables in minibatch.py. (#6275)


Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-28-63.ap-northeast-1.compute.internal>
parent ce14a97c
...@@ -21,40 +21,6 @@ class MiniBatch: ...@@ -21,40 +21,6 @@ class MiniBatch:
representation of input and output data across different stages, ensuring representation of input and output data across different stages, ensuring
consistency and ease of use throughout the loading process.""" consistency and ease of use throughout the loading process."""
sampled_subgraphs: List[SampledSubgraph] = None
"""A list of 'SampledSubgraph's, each one corresponding to one layer,
representing a subset of a larger graph structure.
"""
node_features: Union[
Dict[str, torch.Tensor], Dict[Tuple[str, str], torch.Tensor]
] = None
"""A representation of node features.
- If keys are single strings: It means the graph is homogeneous, and the
keys are feature names.
- If keys are tuples: It means the graph is heterogeneous, and the keys
are tuples of '(node_type, feature_name)'.
"""
edge_features: List[
Union[Dict[str, torch.Tensor], Dict[Tuple[str, str], torch.Tensor]]
] = None
"""Edge features associated with the 'sampled_subgraphs'.
- If keys are single strings: It means the graph is homogeneous, and the
keys are feature names.
- If keys are tuples: It means the graph is heterogeneous, and the keys
are tuples of '(edge_type, feature_name)'. Note, edge type is single
string of format 'str:str:str'.
"""
input_nodes: Union[torch.Tensor, Dict[str, torch.Tensor]] = None
"""A representation of input nodes in the outermost layer. Conatins all nodes
in the 'sampled_subgraphs'.
- If `input_nodes` is a tensor: It indicates the graph is homogeneous.
- If `input_nodes` is a dictionary: The keys should be node type and the
value should be corresponding heterogeneous node id.
"""
seed_nodes: Union[torch.Tensor, Dict[str, torch.Tensor]] = None seed_nodes: Union[torch.Tensor, Dict[str, torch.Tensor]] = None
""" """
Representation of seed nodes used for sampling in the graph. Representation of seed nodes used for sampling in the graph.
...@@ -63,15 +29,6 @@ class MiniBatch: ...@@ -63,15 +29,6 @@ class MiniBatch:
value should be corresponding heterogeneous node ids. value should be corresponding heterogeneous node ids.
""" """
labels: Union[torch.Tensor, Dict[str, torch.Tensor]] = None
"""
labelss associated with seed nodes in the graph.
- If `labels` is a tensor: It indicates the graph is homogeneous. The value
should be corresponding labelss to given 'seed_nodes' or 'node_pairs'.
- If `labels` is a dictionary: The keys should be node or edge type and the
value should be corresponding labelss to given 'seed_nodes' or 'node_pairs'.
"""
node_pairs: Union[ node_pairs: Union[
Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor],
Dict[str, Tuple[torch.Tensor, torch.Tensor]], Dict[str, Tuple[torch.Tensor, torch.Tensor]],
...@@ -85,6 +42,15 @@ class MiniBatch: ...@@ -85,6 +42,15 @@ class MiniBatch:
type. type.
""" """
labels: Union[torch.Tensor, Dict[str, torch.Tensor]] = None
"""
Labels associated with seed nodes / node pairs in the graph.
- If `labels` is a tensor: It indicates the graph is homogeneous. The value
should be corresponding labels to given 'seed_nodes' or 'node_pairs'.
- If `labels` is a dictionary: The keys should be node or edge type and the
value should be corresponding labels to given 'seed_nodes' or 'node_pairs'.
"""
negative_srcs: Union[torch.Tensor, Dict[str, torch.Tensor]] = None negative_srcs: Union[torch.Tensor, Dict[str, torch.Tensor]] = None
""" """
Representation of negative samples for the head nodes in the link Representation of negative samples for the head nodes in the link
...@@ -105,6 +71,40 @@ class MiniBatch: ...@@ -105,6 +71,40 @@ class MiniBatch:
given type. given type.
""" """
sampled_subgraphs: List[SampledSubgraph] = None
"""A list of 'SampledSubgraph's, each one corresponding to one layer,
representing a subset of a larger graph structure.
"""
input_nodes: Union[torch.Tensor, Dict[str, torch.Tensor]] = None
"""A representation of input nodes in the outermost layer. Conatins all nodes
in the 'sampled_subgraphs'.
- If `input_nodes` is a tensor: It indicates the graph is homogeneous.
- If `input_nodes` is a dictionary: The keys should be node type and the
value should be corresponding heterogeneous node id.
"""
node_features: Union[
Dict[str, torch.Tensor], Dict[Tuple[str, str], torch.Tensor]
] = None
"""A representation of node features.
- If keys are single strings: It means the graph is homogeneous, and the
keys are feature names.
- If keys are tuples: It means the graph is heterogeneous, and the keys
are tuples of '(node_type, feature_name)'.
"""
edge_features: List[
Union[Dict[str, torch.Tensor], Dict[Tuple[str, str], torch.Tensor]]
] = None
"""Edge features associated with the 'sampled_subgraphs'.
- If keys are single strings: It means the graph is homogeneous, and the
keys are feature names.
- If keys are tuples: It means the graph is heterogeneous, and the keys
are tuples of '(edge_type, feature_name)'. Note, edge type is single
string of format 'str:str:str'.
"""
compacted_node_pairs: Union[ compacted_node_pairs: Union[
Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor],
Dict[str, Tuple[torch.Tensor, torch.Tensor]], Dict[str, Tuple[torch.Tensor, torch.Tensor]],
......
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