Python tensorpack.callbacks.base.Callback() Examples

The following are 1 code examples of tensorpack.callbacks.base.Callback(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tensorpack.callbacks.base , or try the search function .
Example #1
Source File: expreplay.py    From tensorpack with Apache License 2.0 6 votes vote down vote up
def __iter__(self):
        # wait for memory to be initialized
        self._init_memory_flag.wait()

        while True:
            idx = self.rng.randint(
                0, len(self.mem) - self.history_len - 1,
                size=self.batch_size)
            batch_exp = [self.mem.sample(i) for i in idx]

            yield self._process_batch(batch_exp)

            # execute update_freq=4 new actions into memory, after each batch update
            for _ in range(self.update_frequency):
                self.runner.step(self.exploration)

    # Callback methods: