class_docstr: Masks part of the action space to enforce the agent to work in a defined space. For example,
  if the original action space is between -1 and 1, then this filter can be used in order to constrain the agent actions
  to the range 0 and 1 instead. This essentially masks the range -1 and 0 from the agent.
  The resulting action space will be shifted and will always start from 0 and have the size of the unmasked area.
code: def validate_output_action_space(
      self, output_action_space: BoxActionSpace
  ):
      if not isinstance(output_action_space, BoxActionSpace):
          raise ValueError(
              "BoxActionSpace discretization only works with an output space of type BoxActionSpace. "
              "The given output space is {}".format(output_action_space)
          )
      if (
          self.masked_target_space_low is None
          or self.masked_target_space_high is None
      ):
          raise ValueError(
              "The masking target space size was not set. Please call set_masking."
          )
      if not (
          np.all(
              output_action_space.low <= self.masked_target_space_low
          )
          and np.all(
              self.masked_target_space_low <= output_action_space.high
          )
      ):
          raise ValueError(
              "The low values for masking the action space ({}) are not within the range of the "
              "target space (low = {}, high = {})".format(
                  self.masked_target_space_low,
                  output_action_space.low,
                  output_action_space.high,
              )
          )
      if not (
          np.all(
              output_action_space.low <= self.masked_target_space_high
          )
          and np.all(
              self.masked_target_space_high <= output_action_space.high
          )
      ):
          raise ValueError(
              "The high values for masking the action space ({}) are not within the range of the "
              "target space (low = {}, high = {})".format(
                  self.masked_target_space_high,
                  output_action_space.low,
                  output_action_space.high,
              )
          )
  
file_path: coach/rl_coach/filters/action/box_masking.py
imports: from typing import Union
  import numpy
  from rl_coach.core_types import ActionType
  from rl_coach.filters.action.action_filter import ActionFilter
  from rl_coach.spaces import BoxActionSpace
label_desc: Use image node_id 3 for calling the BoxMasking obj's underlying member method code with example usage: obj.validate_output_action_space(output_action_space) without return types