code: def _remove_num_actions_dim_from_spec(
      observation_spec: types.NestedTensorSpec,
  ) -> types.NestedTensorSpec:
      """Removes the extra `num_actions` dimension from the observation spec."""
      obs_spec_no_num_actions = {
          bandit_spec_utils.GLOBAL_FEATURE_KEY: observation_spec[
              bandit_spec_utils.GLOBAL_FEATURE_KEY
          ],
          bandit_spec_utils.PER_ARM_FEATURE_KEY: tensor_spec.remove_outer_dims_nest(
              observation_spec[bandit_spec_utils.PER_ARM_FEATURE_KEY], 1
          ),
      }
      if bandit_spec_utils.NUM_ACTIONS_FEATURE_KEY in observation_spec:
          obs_spec_no_num_actions.update(
              {
                  bandit_spec_utils.NUM_ACTIONS_FEATURE_KEY: observation_spec[
                      bandit_spec_utils.NUM_ACTIONS_FEATURE_KEY
                  ]
              }
          )
      return obs_spec_no_num_actions
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Callable, Optional, Sequence, Text
  import gin
  import numpy
  import tensorflow
  from tf_agents.bandits.specs import utils
  from tf_agents.networks import encoding_network
  from tf_agents.networks import network
  from tf_agents.networks import q_network
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
label_desc: Use image node_id 1 for calling a global function with example usage: _remove_num_actions_dim_from_spec(observation_spec) and returns: obs_spec_no_num_actions