'Train model using batch.'

def _train(self, sess, observations, initial_state, actions, rewards, terminated, pads):

    if self.use_trust_region:
        (loss, _, summary) = self.model.trust_region_step(sess, observations, initial_state, actions, rewards, terminated, pads, avg_episode_reward=np.mean(self.episode_rewards))
    else:
        (loss, _, summary) = self.model.train_step(sess, observations, initial_state, actions, rewards, terminated, pads, avg_episode_reward=np.mean(self.episode_rewards))
    if self.use_value_opt:
        self.model.fit_values(sess, observations, initial_state, actions, rewards, terminated, pads)
    return (loss, summary)
