How can I change data inside the dataloader?

I collected a dataset from deepmind control suite for a reinforcement learning task. Here is the custom dataset class

class IterableWrapper(IterableDataset):
    def __init__(self, iterator):
        self.iterator = iterator

    def __iter__(self):
        return self.iterator

    def __getitem__(self, index):
        return list(self.iterator)[index]

and here is the Replay class which collected epiodes from the deepmind control :

class Replay:
    def __init__(
        self._directory = pathlib.Path(directory).expanduser()
        self._directory.mkdir(parents=True, exist_ok=True)
        self._capacity = capacity
        self._ongoing = ongoing
        self._minlen = minlen
        self._maxlen = maxlen
        self._prioritize_ends = prioritize_ends
        self._random = np.random.RandomState()
        # filename -> key -> value_sequence
        self._complete_eps = load_episodes(self._directory, capacity, minlen)
        # worker -> key -> value_sequence
        self._ongoing_eps = collections.defaultdict(
            lambda: collections.defaultdict(list)
        self._total_episodes, self._total_steps = count_episodes(directory)
        self._loaded_episodes = len(self._complete_eps)
        self._loaded_steps = sum(eplen(x) for x in self._complete_eps.values())

    def stats(self):
        return {
            "total_steps": self._total_steps,
            "total_episodes": self._total_episodes,
            "loaded_steps": self._loaded_steps,
            "loaded_episodes": self._loaded_episodes,

    def add_step(self, transition, worker=0):
        episode = self._ongoing_eps[worker]
        if isnamedtupleinstance(transition):
           for key, value in transition._asdict().items():
           if transition.done:
        elif isinstance(transition, dict):
            for key, value in transition.items():
            if transition["is_last"]:

    def add_episode(self, episode):
        length = eplen(episode)
        if length < self._minlen:
            print(f"Skipping short episode of length {length}.")
        self._total_steps += length
        self._loaded_steps += length
        self._total_episodes += 1
        self._loaded_episodes += 1
        episode = {key: convert(value) for key, value in episode.items()}
        filename = save_episode(self._directory, episode)
        self._complete_eps[str(filename)] = episode

    def dataset(self, batch, length):
        # example = next(iter(self._generate_chunks(length)))
        dataset = IterableWrapper(iter(self._generate_chunks(length)))
        dataloader = DataLoader(dataset, batch_size=batch)
        return dataloader

    def _generate_chunks(self, length):
        sequence = self._sample_sequence()
        while True:
            chunk = collections.defaultdict(list)
            added = 0
            while added < length:
                needed = length - added
                adding = {k: v[:needed] for k, v in sequence.items()}
                sequence = {k: v[needed:] for k, v in sequence.items()}
                for key, value in adding.items():
                added += len(adding["done"])
                if len(sequence["done"]) < 1:
                    sequence = self._sample_sequence()
            chunk = {k: np.concatenate(v) for k, v in chunk.items()}
            yield chunk

    def _sample_sequence(self):
        episodes = list(self._complete_eps.values())
        if self._ongoing:
            episodes += [
                x for x in self._ongoing_eps.values() if eplen(x) >= self._minlen
        episode = self._random.choice(episodes)
        total = len(episode["done"])
        length = total
        if self._maxlen:
            length = min(length, self._maxlen)
        # Randomize length to avoid all chunks ending at the same time in case the
        # episodes are all of the same length.
        length -= np.random.randint(self._minlen)
        length = max(self._minlen, length)
        upper = total - length + 1
        if self._prioritize_ends:
            upper += self._minlen
        index = min(self._random.randint(upper), total - length)
        sequence = {
            k: convert(v[index : index + length])
            for k, v in episode.items()
            if not k.startswith("log_")
        sequence["is_first"] = np.zeros(len(sequence["done"]), bool)
        sequence["is_first"][0] = True
        if self._maxlen:
            assert self._minlen <= len(sequence["done"]) <= self._maxlen
        return sequence

    def _enforce_limit(self):
        if not self._capacity:
        while self._loaded_episodes > 1 and self._loaded_steps > self._capacity:
            # Relying on Python preserving the insertion order of dicts.
            oldest, episode = next(iter(self._complete_eps.items()))
            self._loaded_steps -= eplen(episode)
            self._loaded_episodes -= 1
            del self._complete_eps[oldest]

each episode has 's1', 's2', 'a1', 'a2', 'reward', 'discount' and 'done'. At some point I use this data from some part of my model. However, I want to update the values of 's1', 's2'. I don’t know how I could extract these fields from the DataLoader. I printed the data
train_dataset = iter(train_replay.dataset(**dataset)) print(f"batch of input data {train_dataset._dataset.__dict__}")
and the output is
batch of input data {'iterator': <generator object Replay._generate_chunks at 0x7fdf7bf3c890>}
Could anyone kindly help me to modify this dataloader?