facebookresearch / EGG

EGG: Emergence of lanGuage in Games
MIT License
281 stars 99 forks source link

add support for custom batches [WIP] #217

Closed robertodessi closed 3 years ago

robertodessi commented 3 years ago

Description

Add support for custom batches.

Related Issue (if any)

159

Motivation and Context

Some games might require additional (possibly non-tensor) data to be passed to the agents. This PR supports this by using a custom Batch class that incapsulates the existing elements of a batch + a dictionary of arbitrary data.

Backwards compatibility is provided with a function that generates a Batch element from a tuple of tensors, as this is the current format for batched data in EGG.

Please note that in this implementation a label parameter is now made optional as it is not always needed e.g. in reconstruction games.

How Has This Been Tested?

doctest pass. UTs are failing as a change in EGG games and agents (+ existing implementations in egg/zoo) should be added

TODO:

robertodessi commented 3 years ago

Thanks! I integrated the comments, it indeed looks simpler and cleaner now