class_docstr: Implements Stationary Stochastic Bandit environments.
code: def _apply_action(
      self, action: types.NestedArray
  ) -> types.NestedArray:
      if len(action) != self.batch_size:
          raise ValueError("Number of actions must match batch size.")
      reward = np.stack(
          [
              self._reward_fns[a](o)
              for a, o in zip(action, self._observation)
          ]  # pytype: disable=attribute-error  # trace-all-classes
      )
      if self._constraint_fns is not None:
          constraint = np.stack(
              [
                  self._constraint_fns[a](o)
                  for a, o in zip(
                      action, self._observation
                  )  # pytype: disable=attribute-error  # trace-all-classes
              ]
          )
          reward = {
              bandits_spec_utils.REWARD_SPEC_KEY: reward,
              bandits_spec_utils.CONSTRAINTS_SPEC_KEY: constraint,
          }
      return reward
  
file_path: agents/tf_agents/bandits/environments/stationary_stochastic_py_environment.py
imports: from typing import Callable, Optional, Sequence, Text
  import gin
  import numpy
  from tf_agents.bandits.environments import bandit_py_environment
  from tf_agents.bandits.specs import utils
  from tf_agents.specs import array_spec
  from tf_agents.typing import types
label_desc: Use image node_id 5 for calling the StationaryStochasticPyEnvironment obj's underlying member method code with example usage: obj._apply_action(action) and returns: reward