code: def configure_logical_cpus():
      """Configures exactly 4 logical CPUs for the first physical CPU.
  
      Assumes no logical configuration exists or it was configured the same way.
  
      **Note**: The reason why the number of logical CPUs fixed is because
      reconfiguring the number of logical CPUs once the underlying runtime has been
      initialized is not supported (raises `RuntimeError`). So, with this choice it
      is ensured that tests running in the same process calling this function
      multiple times do not break.
      """
      first_cpu = tf.config.list_physical_devices("CPU")[0]
      try:
          logical_devices = [
              tf.config.experimental.VirtualDeviceConfiguration()
              for _ in range(4)
          ]
          tf.config.experimental.set_virtual_device_configuration(
              first_cpu, logical_devices=logical_devices
          )
          logging.info(
              "No current virtual device configuration. Defining 4 virtual CPUs on "
              "the first physical one."
          )
      except RuntimeError:
          current_config = (
              tf.config.experimental.get_virtual_device_configuration(
                  first_cpu
              )
          )
          logging.warn(
              "The following virtual device configuration already exists: %s which "
              "resulted this call to fail with `RuntimeError` since it is not "
              "possible to reconfigure it after runtime initialization. It is "
              "probably safe to ignore.",
              current_config,
          )
  
imports: import functools
  from absl import logging
  import numpy
  import reverb
  import tensorflow
  from tf_agents.agents.dqn import dqn_agent
  from tf_agents.agents.ppo import ppo_clip_agent
  from tf_agents.environments import suite_gym
  from tf_agents.experimental.distributed import reverb_variable_container
  from tf_agents.networks import actor_distribution_network
  from tf_agents.networks import sequential
  from tf_agents.networks import value_network
  from tf_agents.policies import py_tf_eager_policy
  from tf_agents.replay_buffers import reverb_replay_buffer
  from tf_agents.specs import tensor_spec
  from tf_agents.train import actor
  from tf_agents.train.utils import replay_buffer_utils
  from tf_agents.train.utils import spec_utils
  from tf_agents.train.utils import train_utils
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
label_desc: Use image node_id 1 for calling a global function with example usage: configure_logical_cpus() without return types