parameters: (self, dev, virtual_devices)
docstring: Set the virtual device configuration for a PhysicalDevice.
docstring_summary: Set the virtual device configuration for a PhysicalDevice.
docstring_tokens: Set the virtual device configuration for a PhysicalDevice .
function: def set_virtual_device_configuration(self, dev, virtual_devices):
      """Set the virtual device configuration for a PhysicalDevice."""
      self._initialize_physical_devices()
  
      if dev not in self._physical_devices:
        raise ValueError("Unrecognized device: %s" % repr(dev))
  
      if dev.device_type == "CPU":
        for vdev in virtual_devices:
          if vdev.memory_limit is not None:
            raise ValueError("Setting memory limit on CPU virtual devices is "
                             "currently not supported")
      elif dev.device_type == "GPU":
        for vdev in virtual_devices:
          if vdev.memory_limit is None:
            raise ValueError(
                "Setting memory limit is required for GPU virtual devices is")
      else:
        raise ValueError("Virtual devices are not supported for %s" %
                         dev.device_type())
  
      if self._virtual_device_map.get(dev) == virtual_devices:
        return
  
      if self._context_handle is not None:
        raise RuntimeError(
            "Virtual devices cannot be modified after being initialized")
  
      self._virtual_device_map[dev] = virtual_devices
function_tokens: def set_virtual_device_configuration ( self , dev , virtual_devices ) : self . _initialize_physical_devices ( ) if dev not in self . _physical_devices : raise ValueError ( "Unrecognized device: %s" % repr ( dev ) ) if dev . device_type == "CPU" : for vdev in virtual_devices : if vdev . memory_limit is not None : raise ValueError ( "Setting memory limit on CPU virtual devices is " "currently not supported" ) elif dev . device_type == "GPU" : for vdev in virtual_devices : if vdev . memory_limit is None : raise ValueError ( "Setting memory limit is required for GPU virtual devices is" ) else : raise ValueError ( "Virtual devices are not supported for %s" % dev . device_type ( ) ) if self . _virtual_device_map . get ( dev ) == virtual_devices : return if self . _context_handle is not None : raise RuntimeError ( "Virtual devices cannot be modified after being initialized" ) self . _virtual_device_map [ dev ] = virtual_devices