def build_update(self): """ Select the network variables and build the operation to copy main weights and biases to the target network. """ self.main_vars = get_vars('main_network', trainable=True) self.target_vars = get_vars('target_network', trainable=False) # Initial operation to start with target_net == main_net self.init_target_op = copy_vars(self.main_vars, self.target_vars, 1, 'init_target') self.target_update = copy_vars(self.main_vars, self.target_vars, Settings.UPDATE_TARGET_RATE, 'update_target')
def build_update(self): """ Build the operation to copy the weights of the learner's actor network in the agent's network. """ with self.sess.as_default(), self.sess.graph.as_default(): self.network_vars = get_vars('learner_actor', trainable=True) self.update = copy_vars(self.network_vars, self.vars, 1, 'update_agent_'+str(self.n_agent))
def build_update(self): """ Select the network variables and build the operation to copy main weights and biases to the target network. """ # Isolate vars for each network self.actor_vars = get_vars('actor', trainable=True) self.critic_vars = get_vars('critic', trainable=True) self.vars = self.actor_vars + self.critic_vars self.target_actor_vars = get_vars('target_actor', trainable=False) self.target_critic_vars = get_vars('target_critic', trainable=False) self.target_vars = self.target_actor_vars + self.target_critic_vars # Initial operation to start with target_net == main_net self.init_target_op = copy_vars(self.vars, self.target_vars, 1, 'init_target') # Update values for target vars towards current actor and critic vars self.target_update = copy_vars(self.vars, self.target_vars, Settings.UPDATE_TARGET_RATE, 'target_update')
def build_update(self): """ Build the operation to copy the weights of the learner's actor network in the agent's network. """ with self.sess.as_default(), self.sess.graph.as_default(): self.network_vars = get_vars('learner_actor', trainable=True) # update agent with the newest actor values # copy_vars copies the values of network_vars to self.vars with update rate '1' self.update = copy_vars( self.network_vars, self. vars, # src, dst, update copy actor with most recent weights 1, 'update_agent_' + str(self.n_agent))