class_docstr: An agent that maintains linear reward estimates and their uncertainties.
class_docstr_tok: ["An","agent","that","maintains","linear","reward","estimates","and","their","uncertainties","."]
docstr: Processes the experience in case the agent accepts only global features.
  
  In the experience coming from the replay buffer, the reward (and all other
  elements) have two batch dimensions `batch_size` and `time_steps`, where
  `time_steps` is the number of driver steps executed in each training loop.
  We flatten the tensors in order to reflect the effective batch size. Then,
  all the necessary processing on the observation is done, including splitting
  the action mask if it is present.
  
  Args:
    experience: An instance of trajectory. Every element in the trajectory has
      two batch dimensions.
  
  Returns:
    A tuple of reward, action, observation, and batch_size. All the outputs
      (except `batch_size`) have a single batch dimension of value
      `batch_size`.
code: def _process_experience_global(self, experience):
      """Processes the experience in case the agent accepts only global features.
  
      In the experience coming from the replay buffer, the reward (and all other
      elements) have two batch dimensions `batch_size` and `time_steps`, where
      `time_steps` is the number of driver steps executed in each training loop.
      We flatten the tensors in order to reflect the effective batch size. Then,
      all the necessary processing on the observation is done, including splitting
      the action mask if it is present.
  
      Args:
        experience: An instance of trajectory. Every element in the trajectory has
          two batch dimensions.
  
      Returns:
        A tuple of reward, action, observation, and batch_size. All the outputs
          (except `batch_size`) have a single batch dimension of value
          `batch_size`.
      """
      reward, _ = nest_utils.flatten_multi_batched_nested_tensors(
          experience.reward, self._time_step_spec.reward
      )
      observation, _ = nest_utils.flatten_multi_batched_nested_tensors(
          experience.observation, self.training_data_spec.observation
      )
      action, _ = nest_utils.flatten_multi_batched_nested_tensors(
          experience.action, self._action_spec
      )
      batch_size = tf.cast(
          tf.compat.dimension_value(tf.shape(reward)[0]), dtype=tf.int64
      )
  
      if self._observation_and_action_constraint_splitter is not None:
          (
              observation,
              _,
          ) = self._observation_and_action_constraint_splitter(
              observation
          )
      if self._add_bias:
          # The bias is added via a constant 1 feature.
          observation = tf.concat(
              [
                  observation,
                  tf.ones([batch_size, 1], dtype=observation.dtype),
              ],
              axis=1,
          )
  
      observation = tf.reshape(
          tf.cast(observation, self._dtype), [batch_size, -1]
      )
      reward = tf.cast(reward, self._dtype)
  
      return reward, action, observation, batch_size
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import enum
  from typing import Optional, Sequence, Text, Tuple
  import gin
  import tensorflow
  from tf_agents.agents import data_converter
  from tf_agents.agents import tf_agent
  from tf_agents.bandits.agents import utils
  from tf_agents.bandits.policies import linalg
  from tf_agents.bandits.policies import linear_bandit_policy
  from tf_agents.bandits.specs import utils
  from tf_agents.policies import utils
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 15 for calling the LinearBanditAgent obj's underlying member method code with example usage: obj._process_experience_global(experience) and returns: reward,  action,  observation,  batch_size