dmlc / dmlc/dgl

Accessing batch id inside a Minibatch

Open
#7,885 1 comment 0 reactions 0 assignees View on GitHub
stale-issue
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## ❓ Questions and Help

Hi! I am wondering if it is possible to access the batch ID of each node type when sampling a minibatch from the Graphbolt neighbor sampler.

For example, in Pyg, it's possible to get something like by using the NeighborLoader(batch_size = 32)
```
batch.batch_dict
{'drivers': tensor([ 0, 1, 2, ..., 30, 30, 6], device='cuda:0'), 'races': tensor([ 0, 0, 0, ..., 28, 27, 28], device='cuda:0'), 'constructors': tensor([ 0, 1, 1, ..., 30, 16, 21], device='cuda:0'), 'constructor_results': tensor([ 0, 0, 0, ..., 31, 31, 31], device='cuda:0'), 'constructor_standings': tensor([ 0, 0, 0, ..., 15, 28, 31], device='cuda:0'), 'results': tensor([ 0, 0, 0, ..., 28, 31, 31], device='cuda:0'), 'circuits': tensor([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
..., 31, 2, 17, 24],
device='cuda:0'), 'standings': tensor([ 0, 0, 0, ..., 24, 24, 24], device='cuda:0'), 'qualifying': tensor([ 0, 0, 0, ..., 27, 27, 27], device='cuda:0')}
```
Here, the `batch_dict` can be used to identify the batch correspondence of a specific row and makes some feature construction much easier.

In Minibatch of Graphbolt's sampler, `batch.indices` is empty by default and `batch.input_nodes` can only give us information about the whole MFG graphs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.