Skip to content

Commit

Permalink
Added pytype None check to agent.py
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 691421088
Change-Id: I345eb6f10e5abd65ad2220425570612abfd6272e
Acme Contributor authored and copybara-github committed Oct 30, 2024
1 parent 766a98b commit 5e7503f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions acme/agents/agent.py
Original file line number Diff line number Diff line change
@@ -82,8 +82,8 @@ def observe(self, action: types.NestedArray, next_timestep: dm_env.TimeStep):
self._num_observations += 1
self._actor.observe(action, next_timestep)

def _has_data_for_training(self):
if self._iterator.ready():
def _has_data_for_training(self, iterator: core.PrefetchingIterator):
if iterator.ready():
return True
for (table, batch_size) in zip(self._replay_tables,
self._batch_size_upper_bounds):
@@ -95,7 +95,7 @@ def update(self): # pytype: disable=signature-mismatch # overriding-parameter-
if self._iterator:
# Perform learner steps as long as iterator has data.
update_actor = False
while self._has_data_for_training():
while self._has_data_for_training(self._iterator):
# Run learner steps (usually means gradient steps).
total_batches = self._iterator.retrieved_elements()
self._learner.step()

0 comments on commit 5e7503f

Please sign in to comment.