class_docstr: trpo class
class_docstr_tok: ["trpo","class"]
docstr: calculate pi loss
  :param states: state batch
  :param actions: action batch
  :param adv: advantage batch
  :param old_log_prob: old log probability
  :return: pi loss
docstr_tok: ["calculate","pi","loss",":","param","states",":","state","batch",":","param","actions",":","action","batch",":","param","adv",":","advantage","batch",":","param","old_log_prob",":","old","log","probability",":","return",":","pi","loss"]
code: def pi_loss(self, states, actions, adv, old_log_prob):
      """
      calculate pi loss
      :param states: state batch
      :param actions: action batch
      :param adv: advantage batch
      :param old_log_prob: old log probability
      :return: pi loss
      """
      mean = self.actor(states)
      pi = tfp.distributions.Normal(mean, tf.exp(self.actor.log_std))
      log_prob = pi.log_prob(actions)[:, 0]
      ratio = tf.exp(log_prob - old_log_prob)
      surr = tf.reduce_mean(ratio * adv)
      return -surr
  
imports: import argparse
  import copy
  import os
  import threading
  import time
  import gym
  import matplotlib.pyplot
  import numpy
  import scipy.signal
  import tensorflow
  import tensorflow_probability
  import tensorlayer
label_desc: Use image node_id 3 for calling the TRPO obj's underlying member method code with example usage: obj.pi_loss(states, actions, adv, old_log_prob) and returns: unknown