class_docstr: An environment wrapper that adds action masks to observations.
class_docstr_tok: ["An","environment","wrapper","that","adds","action","masks","to","observations","."]
code: def _check_action_with_mask(self, action):
      is_allowed = tf.gather(
          self._current_mask,
          tf.expand_dims(action, axis=1),
          batch_dims=1,
      )
      tf.assert_equal(
          is_allowed, 1, message="Action not in allowed action set."
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Callable
  import gin
  import tensorflow
  import tensorflow_probability
  from tf_agents.bandits.environments import bandit_tf_environment
  from tf_agents.policies import utils
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 3 for calling the BernoulliActionMaskTFEnvironment obj's underlying member method code with example usage: obj._check_action_with_mask(action) without return types