Ejemplo n.º 1
0
 def a():
     """ """
     print(torch.cuda.memory_cached(global_torch_device()))
     with TorchCacheSession():
         torch.tensor([0.0], device=global_torch_device())
         print(torch.cuda.memory_cached(global_torch_device()))
     print(torch.cuda.memory_cached(global_torch_device()))
Ejemplo n.º 2
0
 def e():
     """ """
     print(
         global_torch_device(override=global_torch_device(
             device_preference=True)))
     print(global_torch_device())
     with TorchCpuSession():
         print(global_torch_device())
     print(global_torch_device())
Ejemplo n.º 3
0
 def d():
     """ """
     print(
         global_torch_device(override=global_torch_device(
             device_preference=False)))
     print(global_torch_device())
     with TorchCudaSession():
         print(global_torch_device())
     print(global_torch_device())
Ejemplo n.º 4
0
 def __init__(self,
              using_cuda: bool = global_torch_device().type == "cuda"):
     self.using_cuda = using_cuda