Commit 2ad739ad authored by Yuxin Wu's avatar Yuxin Wu

python3 fix in RL/simulator

parent 491e0cd9
...@@ -25,12 +25,13 @@ class GANTrainer(QueueInputTrainerBase): ...@@ -25,12 +25,13 @@ class GANTrainer(QueueInputTrainerBase):
with TowerContext(''): with TowerContext(''):
actual_inputs = self._get_input_tensors_noreuse() actual_inputs = self._get_input_tensors_noreuse()
self.model.build_graph(actual_inputs) self.model.build_graph(actual_inputs)
self.gs_incr = tf.assign_add(get_global_step_var(), 1, name='global_step_incr')
self.g_min = self.config.optimizer.minimize(self.model.g_loss, self.g_min = self.config.optimizer.minimize(self.model.g_loss,
var_list=self.model.g_vars, name='g_op') var_list=self.model.g_vars, name='g_op')
self.d_min = self.config.optimizer.minimize(self.model.d_loss, self.d_min = self.config.optimizer.minimize(self.model.d_loss,
var_list=self.model.d_vars) var_list=self.model.d_vars, name='d_op')
self.d_min = tf.group(self.d_min, summary_moving_average(), name='d_op') self.gs_incr = tf.assign_add(get_global_step_var(), 1, name='global_step_incr')
self.summary_op = summary_moving_average()
self.d_min = tf.group(self.d_min, self.summary_op)
def run_step(self): def run_step(self):
for _ in range(self._opt_g): for _ in range(self._opt_g):
......
...@@ -49,7 +49,8 @@ class SimulatorProcessBase(mp.Process): ...@@ -49,7 +49,8 @@ class SimulatorProcessBase(mp.Process):
def __init__(self, idx): def __init__(self, idx):
super(SimulatorProcessBase, self).__init__() super(SimulatorProcessBase, self).__init__()
self.idx = int(idx) self.idx = int(idx)
self.name = self.identity = u'simulator-{}'.format(self.idx).encode('utf-8') self.name = u'simulator-{}'.format(self.idx)
self.identity = self.name.encode('utf-8')
@abstractmethod @abstractmethod
def _build_player(self): def _build_player(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment