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","."]
code: def _loss(
      self,
      experience: types.NestedTensor,
      weights: Optional[types.Float] = None,
      training: bool = False,
  ) -> tf_agent.LossInfo:
      del training  # unused
      (
          experience_reward,
          action,
          experience_observation,
          _,
      ) = self._process_experience(experience)
      observation, reward = self._maybe_apply_per_example_weight(
          experience_observation, experience_reward, weights
      )
      theta_for_action = tf.gather(params=self._theta, indices=action)
      pred_rewards_for_action = tf.einsum(
          "ij,ij->i", observation, theta_for_action
      )
      loss = tf.losses.mean_squared_error(
          reward, pred_rewards_for_action
      )
      self.compute_summaries(loss)
      return tf_agent.LossInfo(loss, extra=())
  
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 17 for calling the LinearBanditAgent obj's underlying member method code with example usage: obj._loss(experience, weights, training) and returns: tf_agent