not torch.cuda.is_available())
load_kwargs = {}
if disable_cuda:
load_kwargs = {"map_location": lambda store, loc: store}
with tempfile.SpooledTemporaryFile() as f:
f.write(state["cuda_dependent_attributes_"])
f.seek(0)
cuda_attrs = torch.load(f, **load_kwargs)
set_cuda_attrs = {}
state.update(cuda_attrs)
for key in self.cuda_dependent_attributes_:
if key not in cuda_attrs:
continue
set_cuda_attrs[key] = state.pop(key)