dmlc / dmlc/dgl

slice_batch tensor index

Open
#6,400 4 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature

Now we can use slice_batch to get a sample from a batched graph.
Get the 1-st graph:
```
g = dgl.slice_batch(bg, 1)
```

A more advanced idex slicing will be useful:
Get the 1,2,5-th graph and concate then as a new batched graph
```
g = dgl.slice_batch(bg, [1,2,5])
```

A possible work around is to do unbatch and batch again:

```
g = dgl.batch(dgl.unbatch(bg)[:5])
```
but I do think slicing should be a fundamental function in dgl library

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.