Skip to content

Commit 34b91c9

Browse files
committed
Update
1 parent bfd652e commit 34b91c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

conf.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ def reset_seeds(gallery_conf, fname):
122122
torch.set_default_dtype(torch.float32)
123123
torch.set_default_tensor_type(torch.FloatTensor)
124124

125-
# Reset torch modules that might have been modified by tutorials
126-
import importlib
127-
importlib.reload(torch)
128-
if 'torchvision' in sys.modules:
129-
importlib.reload(torchvision)
125+
# Clean up any global state without reloading
126+
if hasattr(torch, "_C"):
127+
if hasattr(torch._C, "_jit_clear_class_registry"):
128+
torch._C._jit_clear_class_registry()
130129

131130
gc.collect()
132131

0 commit comments

Comments
 (0)