code: def _setup_gpu_environment() -> None:
      """Sets configuration for TensorFlow GPU environment based on env variable."""
      gpu_memory_config = os.getenv(ENV_GPU_CONFIG)
  
      if not gpu_memory_config:
          return
  
      # Import from tensorflow only if necessary (environment variable was set)
      from tensorflow import config as tf_config
  
      parsed_gpu_config = _parse_gpu_config(gpu_memory_config)
      physical_gpus = tf_config.list_physical_devices("GPU")
  
      # Logic taken from https://www.tensorflow.org/guide/gpu
      if physical_gpus:
          for gpu_id, gpu_id_memory in parsed_gpu_config.items():
              _allocate_gpu_memory(physical_gpus[gpu_id], gpu_id_memory)
  
      else:
          rasa.shared.utils.io.raise_warning(
              f"You have an environment variable '{ENV_GPU_CONFIG}' set but no GPUs were "
              f"detected to configure."
          )
  
file_path: rasa/rasa/utils/tensorflow/environment.py
imports: import logging
  import os
  from typing import Text, Dict
  import typing
  import rasa.shared.utils.io
  from rasa.constants import ENV_GPU_CONFIG, ENV_CPU_INTER_OP_CONFIG, ENV_CPU_INTRA_OP_CONFIG
  from rasa.utils.tensorflow.constants import TF_DETERMINISTIC_OPS
  from rasa.shared.utils import io
label_desc: Use image node_id 1 for calling a global function with example usage: _setup_gpu_environment() without return types