Loader API¶
DataLoader
¶
Bases: DataLoader
A data loader which merges data objects from a
:class:torch_geometric.data.Dataset to a mini-batch.
Data objects can be either of type :class:~torch_geometric.data.Data or
:class:~torch_geometric.data.HeteroData.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
The dataset from which to load the data. |
required |
batch_size
|
int
|
How many samples per batch to load.
(default: :obj: |
1
|
shuffle
|
bool
|
If set to :obj: |
False
|
follow_batch
|
List[str]
|
Creates assignment batch
vectors for each key in the list. (default: :obj: |
None
|
exclude_keys
|
List[str]
|
Will exclude each key in the
list. (default: :obj: |
None
|
**kwargs
|
optional
|
Additional arguments of
:class: |
{}
|
Source code in lumina/loader/opf/opf_loader.py
Collater
¶
Custom collation function for PyG data objects.
Handles batching of BaseData objects via Batch.from_data_list,
as well as tensors, TensorFrame instances, and nested Python
collections (dicts, named tuples, lists).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset | Sequence[BaseData] | DatasetAdapter
|
Source dataset (used for type inference; not indexed during collation). |
required |
follow_batch
|
list[str]
|
Keys for which to create assignment batch vectors. |
None
|
exclude_keys
|
list[str]
|
Keys to exclude from batching. |
None
|
Source code in lumina/loader/opf/opf_loader.py
__call__(batch: List[Any]) -> Any
¶
Collate a list of data elements into a batch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch
|
list[Any]
|
List of individual data elements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Batched data, whose type depends on the element type. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the element type is not supported. |