mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 11:40:18 +01:00
Cleanup and refactoring (#171)
This commit is contained in:
committed by
Gal Leibovich
parent
cd812b0d25
commit
fedb4cbd7c
@@ -346,6 +346,10 @@ class GraphManager(object):
|
||||
|
||||
@contextlib.contextmanager
|
||||
def phase_context(self, phase):
|
||||
"""
|
||||
Create a context which temporarily sets the phase to the provided phase.
|
||||
The previous phase is restored afterwards.
|
||||
"""
|
||||
old_phase = self.phase
|
||||
self.phase = phase
|
||||
yield
|
||||
@@ -464,8 +468,11 @@ class GraphManager(object):
|
||||
|
||||
count_end = self.current_step_counter + steps
|
||||
while self.current_step_counter < count_end:
|
||||
# The actual steps being done on the environment are decided by the agents themselves.
|
||||
# This is just an high-level controller.
|
||||
# The actual number of steps being done on the environment
|
||||
# is decided by the agent, though this inner loop always
|
||||
# takes at least one step in the environment. Depending on
|
||||
# internal counters and parameters, it doesn't always train
|
||||
# or save checkpoints.
|
||||
self.act(EnvironmentSteps(1))
|
||||
self.train()
|
||||
self.occasionally_save_checkpoint()
|
||||
|
||||
Reference in New Issue
Block a user