コード例 #1
0
ファイル: cache_sessions.py プロジェクト: cnheider/draugr
 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()))
コード例 #2
0
ファイル: cache_sessions.py プロジェクト: cnheider/draugr
 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())
コード例 #3
0
ファイル: cache_sessions.py プロジェクト: cnheider/draugr
 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())
コード例 #4
0
ファイル: cache_sessions.py プロジェクト: pything/draugr
 def __init__(self,
              using_cuda: bool = global_torch_device().type == "cuda"):
     self.using_cuda = using_cuda