gammagl.data.InMemoryDataset¶
- class InMemoryDataset(root: str | None = None, transform: Callable | None = None, pre_transform: Callable | None = None, pre_filter: Callable | None = None, force_reload: bool = False)[source]¶
Bases:
Dataset
Dataset base class for creating graph datasets which easily fit into CPU memory. Inherits from
gammagl.data.Dataset
. See here for the accompanying tutorial.- Parameters:
root (str, optional) – Root directory where the dataset should be saved. (default:
None
)transform (callable, optional) – A function/transform that takes in an
gammagl.data.Graph
object and returns a transformed version. The graph object will be transformed before every access. (default:None
)pre_transform (callable, optional) – A function/transform that takes in an
gammagl.data.Graph
object and returns a transformed version. The graph object will be transformed before being saved to disk. (default:None
)pre_filter (callable, optional) – A function that takes in an
gammagl.data.Graph
object and returns a boolean value, indicating whether the graph object should be included in the final dataset. (default:None
)force_reload (bool, optional) – Whether to re-process the dataset.(default:
False
)
- property raw_file_names: str | List[str] | Tuple¶
The name of the files in the
self.raw_dir
folder that must be present in order to skip downloading.
- property processed_file_names: str | List[str] | Tuple¶
The name of the files in the
self.processed_dir
folder that must be present in order to skip processing.
- static collate(data_list: List[Graph])[source]¶
Collates a Python list of
gammagl.data.Graph
objects to the internal storage format ofInMemoryDataset
.
- copy(idx: slice | ndarray | Sequence | None = None) InMemoryDataset [source]¶
Performs a deep-copy of the dataset. If
idx
is not given, will clone the full dataset. Otherwise, will only clone a subset of the dataset from indicesidx
. Indices can be slices, lists, tuples, and aTensor
ornp.ndarray
of type long or bool.