import tensorflow as tf

                with tf.name_scope('pull'):  # 获取global参数,复制到local—net
                    self.pull_params_op = tf.group(*[v1.assign(v2)
                                                     for v1, v2 in zip(self.var_list, globalAC.var_list)])
                with tf.name_scope('push'):  # 将参数传送到gloabl中去
                    self.update_params_op = OPT.apply_gradients(zip(grads, globalAC.var_list))
                    # 其中传送的是local—net的actor和critic的参数梯度grads,具体计算在上面定义
                    # apply_gradients是tf.train.Optimizer中自带的功能函数，将求得的梯度参数更新到global中
            self.inc_step = self.global_step.assign_add(tf.shape(self.obs)[0])
            self.train_op = tf.group(self.update_params_op, self.inc_step)
            # GLOBALE_STEP += tf.shape(self.obs)[0]

    def build_model(self):
        """
        Builds the manager and worker models.
        """
        with tf.variable_scope('FeUdal'):
            self.build_placeholders()
            self.build_perception()
            self.build_manager()
            self.build_worker()
            self.build_loss()
            self.var_list = tf.get_collection(
                tf.GraphKeys.TRAINABLE_VARIABLES, tf.get_variable_scope().name)
        # for v in self.var_list:
        #     print v.name

        self.state_in = [self.worker_lstm.state_in[0],
                         self.worker_lstm.state_in[1],
                         self.manager_lstm.state_in[0],
                         self.manager_lstm.state_in[1]
