docstr: Test that temperature updates perform as expected as it is increased.
docstr_tok: ["Test","that","temperature","updates","perform","as","expected","as","it","is","increased","."]
code: def testInverseTempUpdate(self, observation_shape, weights, seed):
      """Test that temperature updates perform as expected as it is increased."""
      observation_spec = tensor_spec.TensorSpec(
          shape=observation_shape,
          dtype=tf.float32,
          name="observation_spec",
      )
      time_step_spec = time_step.time_step_spec(observation_spec)
  
      weight_var = tf.compat.v2.Variable(weights, dtype=tf.float32)
      inverse_temperature_var = tf.compat.v2.Variable(
          TEMP_UPDATE_TEST_INITIAL_INVERSE_TEMP, dtype=tf.float32
      )
      action_spec = tensor_spec.BoundedTensorSpec(
          shape=(),
          dtype=tf.int64,
          minimum=0,
          maximum=tf.compat.dimension_value(weight_var.shape[0]) - 1,
          name="action",
      )
      policy = categorical_policy.CategoricalPolicy(
          weight_var,
          time_step_spec,
          action_spec,
          inverse_temperature_var,
      )
      observation_step = _get_dummy_observation_step(
          observation_shape, TEMP_UPDATE_TEST_BATCH_SIZE
      )
      tf.compat.v1.set_random_seed(seed)
      self.evaluate(tf.compat.v1.global_variables_initializer())
  
      # Set the inverse temperature to a large value.
      self.evaluate(
          tf.compat.v1.assign(
              inverse_temperature_var,
              TEMP_UPDATE_TEST_FINAL_INVERSE_TEMP,
          )
      )
  
      final_action_time_step = self.evaluate(
          policy.action(observation_step, seed=seed)
      )
      self.assertAllEqual(
          final_action_time_step.action,
          np.full([TEMP_UPDATE_TEST_BATCH_SIZE], np.argmax(weights)),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  import tensorflow_probability
  from tf_agents.bandits.policies import categorical_policy
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.utils import test_utils
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 3 for calling the CategoricalPolicyTest obj's underlying member method code with example usage: obj.testInverseTempUpdate(observation_shape, weights, seed) without return types