question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sub-batch of a batch

See original GitHub issue

🚀 The feature, motivation and pitch

I would like to be able to index a batch to obtain a sub-batch, rather than a list of data objects. E.g. if I have a Batch object my_batch, then something like my_batch.subbatch(np.arange(5)) would return another Batch object containing the first 5 graphs in my_batch. Perhaps this can be achieved by calling subgraph as a subroutine.

Alternatives

Of course, Batch.from_data_list(my_batch[:5]) would achieve this functionality, but this seems slow. I would like to directly construct a sub-batch, if possible.

Additional context

In my particular application, I have a list of Data objects, and I need to include a non-decreasing number of them in a Batch every time I pass them into my GNN. I could pass Batch.from_data_list(my_list[:i]) into my GNN for each iteration i, but I presume it would be faster if I could just construct a batch of this whole list at the start, complete_batch, and then access sub-batches of that complete batch, passing complete_batch.subbatch(np.arange(i)) at each iteration i.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ArchieGertsmancommented, Jun 23, 2022

Should we could reuse the logic in the index_select method for selecting the sub-batch elements as input into the sub-batch function? In PR above, currently requires that the input is Tensor.bool, but I think it could be generalized to the same input as used to return a list of elements as done in the linked function.

Good point, I have now added this.

1reaction
josiahbjorgaardcommented, Jun 23, 2022

Should we could reuse the logic in the index_select method for selecting the sub-batch elements as input into the sub-batch function? In PR above, currently requires that the input is Tensor.bool, but I think it could be generalized to the same input as used to return a list of elements as done in the linked function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

subbatch: meaning, definition - WordSense Dictionary
Noun. subbatch (pl. subbatches). A batch that forms part of a larger batch. Dictionary entries.
Read more >
How are sub-batches obtained and labelled? - EDQM FAQs
Answer: Sub-batches are obtained by filling containers with material from the same batch of bulk material. All necessary precautions are taken ...
Read more >
Batch vs. Sub-Batch - WinBill for Municipal Utilities
A Sub-Batch (which is an optional feature) provides a further breakdown of a particular batch and is typically used to allow two or...
Read more >
sub-batch - crates.io: Rust Package Registry
sub-batch. Match and rename subtitle files to video files and perfom other batch operations on subtitle files.
Read more >
sub batches process | SAP Community
Dear All, We have have scnario where we do production thru production order and batche number is activated after release of order.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found