Allow an option to specify Key:Value outputs from dataloaders as opposed to index:value outputs.
- Dominant language
- Python
- Stars
- 14.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
## 🚀 Feature
Currently, DGL dataloaders return an indexed list when iterated through, IE.
```
dataloader = dgl.dataloading.Dataloader(....)
for input_nodes, output_nodes, blocks:
do_train(...)
```
The proposal:
```
dataloader = dgl.dataloading.Dataloader(...., return_dict=True)
for batch in dataloader:
input_nodes = batch['input_nodes']
do_train(...)
```
## Motivation
Although what currently exists is perfect generic default behavior, some applications and models could benefit from returning a dictionary, IE in the case where you would want to build models that can be used in multiple contexts, like RGCN that can be applied as the state generator for a link prediction task, or as the predictor in a node classification task. The differently sized input between these two tasks obviously can't be unpacked in the same way, but having access to key values that are shared, like input nodes and blocks is key allows the model definition to be applied to multiple different task types while still accepting batch as input.
## Pitch
An additional flag in dataloader instantiation that when turned on causes dicts to be returned instead of lists.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.