Пример #1
0
    def map_location(storage: torch.Storage, location) -> torch.Storage:
        """
        Args:
            storage (torch.Storage) : the initial deserialization of the
                storage of the data read by `torch.load`, residing on the CPU.
            location (str): tag identifiying the location the data being read
                by `torch.load` was originally saved from.

        Returns:
            torch.Storage : the storage
        """
        xpu = xpu_device.XPU(gpu_num)
        if xpu.is_gpu():
            return storage.cuda(xpu.num)
        else:
            return storage
Пример #2
0
 def inner_device_mapping(storage: torch.Storage, location) -> torch.Storage:  # pylint: disable=unused-argument
     if cuda_device >= 0:
         return storage.cuda(cuda_device)
     else:
         return storage
Пример #3
0
 def inner_device_mapping(storage: torch.Storage, location) -> torch.Storage:  # pylint: disable=unused-argument
     if cuda_device >= 0:
         return storage.cuda(cuda_device)
     else:
         return storage
Пример #4
0
 def inner_device_mapping(storage: torch.Storage,
                          location) -> torch.Storage:
     if cuda_device >= 0:
         return storage.cuda(cuda_device)
     else:
         return storage