We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbc1679 commit d9fd97eCopy full SHA for d9fd97e
1 file changed
test/test___init__.py
@@ -76,7 +76,7 @@ def memory_leak(device, context=None):
76
if context is None:
77
context = nullcontext
78
79
- for _ in range(steps):
+ for s in range(steps):
80
lossfunc = torch.nn.CrossEntropyLoss().to(device)
81
lossfunc = extend(lossfunc)
82
@@ -87,6 +87,7 @@ def memory_leak(device, context=None):
87
loss = lossfunc(model(X), y) # this is what kills it
88
89
memory = pytorch_current_memory_usage()
90
+ print(f"Step {s}, Memory delta: {(memory - memory_init) / 2**20:.2f} MiB.")
91
if memory - memory_init > memory_leak_threshold:
92
raise RuntimeError(
93
f"Memory leak detected: context={context}, device={device}"
0 commit comments