class_docstr: Categorical probability distribution
docstr: sample from logits
docstr_tok: ["sample","from","logits"]
code: def sample(self):
      """sample from logits"""
      if not self.is_act_model:
          re_res = tf.reshape(self.logits, [-1, self.nsteps, self.size])
          masked_res = tf.math.add(re_res, self.mask_npinf)
          re_masked_res = tf.reshape(masked_res, [-1, self.size])
  
          u = tf.random_uniform(
              tf.shape(re_masked_res), dtype=self.logits.dtype
          )
          return tf.argmax(
              re_masked_res - tf.log(-1 * tf.log(u)), axis=-1
          )
      else:
          u = tf.random_uniform(
              tf.shape(self.logits), dtype=self.logits.dtype
          )
          return tf.argmax(
              self.logits - tf.log(-1 * tf.log(u)), axis=-1
          )
  
imports: import tensorflow.compat.v1
  from .util import fc
label_desc: Use image node_id 8 for calling the CategoricalPd obj's underlying member method code with example usage: obj.sample() and returns: tf, tf