code: def mlp_categorical_policy(
      x, a, hidden_sizes, activation, output_activation, action_space
  ):
      act_dim = action_space.n
      logits = mlp(x, list(hidden_sizes) + [act_dim], activation, None)
      logp_all = tf.nn.log_softmax(logits)
      pi = tf.squeeze(tf.multinomial(logits, 1), axis=1)
      logp = tf.reduce_sum(
          tf.one_hot(a, depth=act_dim) * logp_all, axis=1
      )
      logp_pi = tf.reduce_sum(
          tf.one_hot(pi, depth=act_dim) * logp_all, axis=1
      )
  
      old_logp_all = placeholder(act_dim)
      d_kl = categorical_kl(logp_all, old_logp_all)
  
      info = {"logp_all": logp_all}
      info_phs = {"logp_all": old_logp_all}
  
      return pi, logp, logp_pi, info, info_phs, d_kl
  
imports: import numpy
  import tensorflow
  import scipy.signal
  from gym.spaces import Box, Discrete
label_desc: Use image node_id 19 for calling a global function with example usage: mlp_categorical_policy(x, a, hidden_sizes, activation, output_activation, action_space) and returns: pi,  logp,  logp_pi,  info,  info_phs,  d_kl