class_docstr: Example of a custom env, for which you can specify rendering behavior.
class_docstr_tok: ["Example","of","a","custom","env",",","for","which","you","can","specify","rendering","behavior","."]
docstr: Implements rendering logic for this env (given current state).
  
  You can either return an RGB image:
  np.array([height, width, 3], dtype=np.uint8) or take care of
  rendering in a window yourself here (return True then).
  For RLlib, though, only mode=rgb (returning an image) is needed,
  even when "render_env" is True in the RLlib config.
  
  Args:
      mode: One of "rgb", "human", or "ascii". See gym.Env for
          more information.
  
  Returns:
      Union[np.ndarray, bool]: An image to render or True (if rendering
          is handled entirely in here).
docstr_tok: ["Implements","rendering","logic","for","this","env","(","given","current","state",")",".","You","can","either","return","an","RGB","image",":","np.array","(","[","height",",","width",",","3","]",",","dtype=np.uint8",")","or","take","care","of","rendering","in","a","window","yourself","here","(","return","True","then",")",".","For","RLlib",",","though",",","only","mode=rgb","(","returning","an","image",")","is","needed",",","even","when","``","render_env","''","is","True","in","the","RLlib","config",".","Args",":","mode",":","One","of","``","rgb","''",",","``","human","''",",","or","``","ascii","''",".","See","gym.Env","for","more","information",".","Returns",":","Union","[","np.ndarray",",","bool","]",":","An","image","to","render","or","True","(","if","rendering","is","handled","entirely","in","here",")","."]
code: def render(self, mode="rgb"):
      """Implements rendering logic for this env (given current state).
  
      You can either return an RGB image:
      np.array([height, width, 3], dtype=np.uint8) or take care of
      rendering in a window yourself here (return True then).
      For RLlib, though, only mode=rgb (returning an image) is needed,
      even when "render_env" is True in the RLlib config.
  
      Args:
          mode: One of "rgb", "human", or "ascii". See gym.Env for
              more information.
  
      Returns:
          Union[np.ndarray, bool]: An image to render or True (if rendering
              is handled entirely in here).
      """
  
      # Just generate a random image here for demonstration purposes.
      # Also see `gym/envs/classic_control/cartpole.py` for
      # an example on how to use a Viewer object.
      return np.random.randint(
          0, 256, size=(300, 400, 3), dtype=np.uint8
      )
  
file_path: ray/rllib/examples/env_rendering_and_recording.py
imports: import argparse
  import gymnasium
  import numpy
  import ray
  from gymnasium.spaces import Box, Discrete
  from ray import air, tune
  from ray.rllib.algorithms.ppo import PPOConfig
  from ray.rllib.env.multi_agent_env import make_multi_agent
label_desc: Use image node_id 4 for calling the CustomRenderedEnv obj's underlying member method code with example usage: obj.render(mode) and returns: np