Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions acme/datasets/tfds.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ def sample_and_postprocess(key: jnp.ndarray) -> Tuple[Any, jnp.ndarray]:
data, key = pmapped_sample(self._jax_dataset, key)
# All pmapped devices return the same data, so we just take the one from
# the first device.
from acme.jax import utils as jax_utils_acme
return (
jax.tree_util.tree_map(
lambda x: x.addressable_shards[0].data.squeeze(0), data
),
jax_utils_acme.get_from_first_device(data, as_numpy=False),
key,
)
self._sample = sample_and_postprocess
Expand Down