class_docstr: Wrapper around it's environment, to simplify configuration.
class_docstr_tok: ["Wrapper","around","it","'s","environment",",","to","simplify","configuration","."]
code: def action_extractor(
      self, actor_output: rlt.ActorOutput
  ) -> torch.Tensor:
      action = actor_output.action
      action_space = self.action_space
      # Canonical rule to return one-hot encoded actions for discrete
      assert (
          len(action.shape) == 2 and action.shape[0] == 1
      ), f"{action} (shape: {action.shape}) is not a single action!"
      if isinstance(action_space, spaces.Discrete):
          return action.squeeze(0).argmax()
      elif isinstance(action_space, spaces.MultiDiscrete):
          return action.squeeze(0)
      # Canonical rule to scale actions to CONTINUOUS_TRAINING_ACTION_RANGE
      elif isinstance(action_space, spaces.Box):
          assert (
              len(action_space.shape) == 1
          ), f"{action_space} not supported."
          return rescale_actions(
              action.squeeze(0),
              new_min=torch.tensor(action_space.low),
              new_max=torch.tensor(action_space.high),
              prev_min=CONTINUOUS_MODEL_LOW,
              prev_max=CONTINUOUS_MODEL_HIGH,
          )
      else:
          raise NotImplementedError(
              f"Unsupported action space: {action_space}"
          )
  
imports: import abc
  import logging
  from typing import Callable, Optional
  import gym
  import numpy
  import reagent.core.types
  import torch
  from gym import spaces
  from reagent.core.dataclasses import dataclass
  from reagent.core.parameters import CONTINUOUS_TRAINING_ACTION_RANGE
  from reagent.core.registry_meta import RegistryMeta
  from reagent.training.utils import rescale_actions
label_desc: Use image node_id 7 for calling the EnvWrapper obj's underlying member method code with example usage: obj.action_extractor(actor_output) and returns: action, action, rescale_actions