code: def test_space_inference_from_remote_workers(self):
      # Expect to not do space inference if the learner has an env.
  
      env = gym.make("CartPole-v1")
  
      config = (
          ppo.PPOConfig()
          .rollouts(
              num_rollout_workers=1,
              validate_workers_after_construction=False,
          )
          .environment(env="CartPole-v1")
      )
  
      # No env on driver -> expect longer build time due to space
      # lookup from remote worker.
      t0 = time.time()
      algo = config.build()
      w_lookup = time.time() - t0
      print(f"No env on learner: {w_lookup}sec")
      algo.stop()
  
      # Env on driver -> expect shorted build time due to no space
      # lookup required from remote worker.
      config.create_env_on_local_worker = True
      t0 = time.time()
      algo = config.build()
      wo_lookup = time.time() - t0
      print(f"Env on learner: {wo_lookup}sec")
      self.assertLess(wo_lookup, w_lookup)
      algo.stop()
  
      # Spaces given -> expect shorter build time due to no space
      # lookup required from remote worker.
      config.create_env_on_local_worker = False
      config.environment(
          observation_space=env.observation_space,
          action_space=env.action_space,
      )
      t0 = time.time()
      algo = config.build()
      wo_lookup = time.time() - t0
      print(f"Spaces given manually in config: {wo_lookup}sec")
      self.assertLess(wo_lookup, w_lookup)
      algo.stop()
  
imports: import gymnasium
  import numpy
  import os
  from pathlib import Path
  from random import choice
  import time
  import unittest
  import ray
  import ray.rllib.algorithms.dqn
  from ray.rllib.algorithms.bc import BCConfig
  import ray.rllib.algorithms.ppo
  from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
  from ray.rllib.examples.parallel_evaluation_and_training import AssertEvalCallback
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO
  from ray.rllib.utils.test_utils import check, framework_iterator
label_desc: Use image node_id 7 for calling the TestAlgorithm obj's underlying member method code with example usage: obj.test_space_inference_from_remote_workers() without return types