code: def _allocate_gpu_memory(
      gpu_instance: "tf_config.PhysicalDevice", logical_memory: int
  ) -> None:
      """Create a new logical device for the requested amount of memory.
  
      Args:
          gpu_instance: PhysicalDevice instance of a GPU device.
          logical_memory: Absolute amount of memory to be allocated to the new logical
              device.
      """
      from tensorflow import config as tf_config
  
      try:
          tf_config.experimental.set_virtual_device_configuration(
              gpu_instance,
              [
                  tf_config.experimental.VirtualDeviceConfiguration(
                      memory_limit=logical_memory
                  )
              ],
          )
  
      except RuntimeError:
          # Helper explanation of where the error comes from
          raise RuntimeError(
              "Error while setting up tensorflow environment. "
              "Virtual devices must be set before GPUs have been initialized."
          )
  
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 2 for calling a global function with example usage: _allocate_gpu_memory(gpu_instance, logical_memory) without return types