Ejemplo n.º 1
0
Archivo: nnio.py Proyecto: afcarl/clab
    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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 4
0
 def inner_device_mapping(storage: torch.Storage,
                          location) -> torch.Storage:
     if cuda_device >= 0:
         return storage.cuda(cuda_device)
     else:
         return storage