class_docstr: Wraps an environment with continuous actions and discretizes them.
  
  This is a simplified adaptation of ActionDiscretizeWrapper
  from tf_agents.
docstr: Constructs a wrapper for discretizing the action space.
  
  Args:
    env: environment to wrap.
    num_actions: A np.array of the same shape as the environment's
      action_spec. Elements in the array specify the number of actions to
      discretize to for each dimension.
  
  Raises:
    ValueError: IF the action_spec shape and the limits shape are not equal.
docstr_tok: ["Constructs","a","wrapper","for","discretizing","the","action","space",".","Args",":","env",":","environment","to","wrap",".","num_actions",":","A","np.array","of","the","same","shape","as","the","environment's","action_spec",".","Elements","in","the","array","specify","the","number","of","actions","to","discretize","to","for","each","dimension",".","Raises",":","ValueError",":","IF","the","action_spec","shape","and","the","limits","shape","are","not","equal","."]
code: def __init__(self, env, num_actions):
      """Constructs a wrapper for discretizing the action space.
  
      Args:
        env: environment to wrap.
        num_actions: A np.array of the same shape as the environment's
          action_spec. Elements in the array specify the number of actions to
          discretize to for each dimension.
  
      Raises:
        ValueError: IF the action_spec shape and the limits shape are not equal.
      """
  
      if not isinstance(env.action_space, gym.spaces.box.Box):
          raise ValueError(
              "The action space is {}, but gym.spaces.box.Box is expected".format(
                  env.action_space
              )
          )
  
      gym.Wrapper.__init__(self, env)
  
      # We convert a scalar num_actions to array [num_actions, num_actions, ...]
      self._num_actions = np.broadcast_to(
          num_actions, env.action_space.shape
      )
  
      if env.action_space.shape != self._num_actions.shape:
          raise ValueError(
              "Spec {} and limit shape do not match. Got {}".format(
                  env.action_space.shape, self._num_actions.shape
              )
          )
      self.action_space = gym.spaces.MultiDiscrete(
          nvec=self._num_actions
      )
      self._action_map = self._discretize_env(env)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from absl import logging
  import gym
  import gym.wrappers
  import numpy
  from PIL import Image
label_desc: Use image node_id 1 to create a new ActionDiscretizeWrapper object from inherited base classes: gym with example: obj = ActionDiscretizeWrapper(env, num_actions)