mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 19:50:17 +01:00
remove return values from GraphManager.act
This commit is contained in:
@@ -360,8 +360,6 @@ class GraphManager(object):
|
|||||||
:param return_on_game_over: finish acting if an episode is finished
|
:param return_on_game_over: finish acting if an episode is finished
|
||||||
:param continue_until_game_over: continue playing until an episode was completed
|
:param continue_until_game_over: continue playing until an episode was completed
|
||||||
:param keep_networks_in_sync: sync the network parameters with the global network before each episode
|
:param keep_networks_in_sync: sync the network parameters with the global network before each episode
|
||||||
:return: the actual number of steps done, a boolean value that represent if the episode was done when finishing
|
|
||||||
the function call
|
|
||||||
"""
|
"""
|
||||||
self.verify_graph_was_created()
|
self.verify_graph_was_created()
|
||||||
|
|
||||||
@@ -408,13 +406,7 @@ class GraphManager(object):
|
|||||||
if keep_networks_in_sync:
|
if keep_networks_in_sync:
|
||||||
self.sync_graph()
|
self.sync_graph()
|
||||||
if return_on_game_over:
|
if return_on_game_over:
|
||||||
return self.total_steps_counters[self.phase][EnvironmentSteps] - initial_count, True
|
return
|
||||||
|
|
||||||
# return the game over status
|
|
||||||
if result:
|
|
||||||
return self.total_steps_counters[self.phase][EnvironmentSteps] - initial_count, result.game_over
|
|
||||||
else:
|
|
||||||
return self.total_steps_counters[self.phase][EnvironmentSteps] - initial_count, False
|
|
||||||
|
|
||||||
def train_and_act(self, steps: StepMethod) -> None:
|
def train_and_act(self, steps: StepMethod) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -466,7 +458,7 @@ class GraphManager(object):
|
|||||||
# act for at least `steps`, though don't interrupt an episode
|
# act for at least `steps`, though don't interrupt an episode
|
||||||
count_end = self.total_steps_counters[self.phase][steps.__class__] + steps.num_steps
|
count_end = self.total_steps_counters[self.phase][steps.__class__] + steps.num_steps
|
||||||
while self.total_steps_counters[self.phase][steps.__class__] < count_end:
|
while self.total_steps_counters[self.phase][steps.__class__] < count_end:
|
||||||
steps_done, _ = self.act(steps, continue_until_game_over=True, return_on_game_over=True,
|
self.act(steps, continue_until_game_over=True, return_on_game_over=True,
|
||||||
keep_networks_in_sync=keep_networks_in_sync)
|
keep_networks_in_sync=keep_networks_in_sync)
|
||||||
|
|
||||||
self.phase = RunPhase.UNDEFINED
|
self.phase = RunPhase.UNDEFINED
|
||||||
|
|||||||
Reference in New Issue
Block a user