How to use the gym-unity.gym_unity.envs.__init__.ActionFlattener function in gym-unity

To help you get started, we’ve selected a few gym-unity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Unity-Technologies / ml-agents / gym-unity / gym_unity / envs / View on Github external
"Otherwise, please note that only the first will be provided in the observation."

        # Check for number of agents in scene.
        step_result = self._env.get_step_result(self.brain_name)

        # Set observation and action spaces
        if self.group_spec.is_action_discrete():
            branches = self.group_spec.discrete_action_branches
            if self.group_spec.action_shape == 1:
                self._action_space = spaces.Discrete(branches[0])
                if flatten_branched:
                    self._flattener = ActionFlattener(branches)
                    self._action_space = self._flattener.action_space
                    self._action_space = spaces.MultiDiscrete(branches)

            if flatten_branched:
                    "The environment has a non-discrete action space. It will "
                    "not be flattened."
            high = np.array([1] * self.group_spec.action_shape)
            self._action_space = spaces.Box(-high, high, dtype=np.float32)
        high = np.array([np.inf] * self._get_vec_obs_size())
        if self.use_visual:
            shape = self._get_vis_obs_shape()
            if uint8_visual: