code: def compute_uncertainty_reward(logits, predictions):
      """Uncertainty reward based on logits."""
      # TODO(rsepassi): Add support for L1/L2 loss models. Current code only
      # works for softmax models.
      vocab_size = logits.shape[-1]
      assert vocab_size > 1
      log_probs = common_layers.log_prob_from_logits(logits)
      max_log_probs = common_layers.index_last_dim_with_indices(
          log_probs, predictions
      )
      # Threshold
      neg_log_prob = tf.nn.relu(-max_log_probs - 0.02)
      # Sum across all but the batch dimension
      reduce_dims = list(range(len(neg_log_prob.shape)))[1:]
      summed = tf.reduce_sum(neg_log_prob, axis=reduce_dims)
      return summed / 10
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import os
  import numpy
  from tensor2tensor.data_generators.gym_env import DummyWorldModelProblem
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.rl.envs import in_graph_batch_env
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 3 for calling a global function with example usage: compute_uncertainty_reward(logits, predictions) and returns: unknown