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: Optionally applies per-example weight to observation and rewards.
code: def _maybe_apply_per_example_weight(
      self,
      observation: tf.Tensor,
      reward: tf.Tensor,
      weights: Optional[tf.Tensor],
  ) -> Tuple[tf.Tensor, tf.Tensor]:
      """Optionally applies per-example weight to observation and rewards."""
      if weights is None:
          return (observation, reward)
      else:
          w_sqrt = tf.sqrt(tf.cast(weights, dtype=self._dtype))
          return (
              tf.reshape(w_sqrt, [-1, 1]) * observation,
              w_sqrt * reward,
          )
  
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 16 for calling the LinearBanditAgent obj's underlying member method code with example usage: obj._maybe_apply_per_example_weight(observation, reward, weights) and returns: observation,  reward, unknown,  unknown