import tensorflow as tf


        self.sample_action = tf.squeeze(pi_eval.sample(1), axis=0)
        self.eval_action = pi_eval.mode()
        self.global_step = tf.train.get_or_create_global_step()
        self.saver = tf.train.Saver()
        # Loss functions and training
        loss_pg = - tf.reduce_mean(pi.log_prob(batch['actions']) * batch['advantage']) - 0.01 * tf.reduce_mean(pi.entropy())
        loss_vf = 0.5 * tf.reduce_mean(tf.square(batch['rewards'] - self.vf))
        self.a_grads = tf.gradients(loss_pg, self.pi_params)
        self.c_grads = tf.gradients(loss_vf, self.vf_params)
        self.a_grads, _ = tf.clip_by_global_norm(self.a_grads, 20.0)
        self.c_grads, _ = tf.clip_by_global_norm(self.c_grads, 20.0)
        opt = tf.train.AdamOptimizer(self.LR)
        self.update_a_op = opt.apply_gradients(zip(self.a_grads, self.pi_params))
