You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not an expert on python garbage collection. This is what I get from ChatGPT:
Is del query Necessary?
In most cases, explicit del statements are not required because Python’s garbage collector (GC) will eventually free the memory for variables that go out of scope. However:
When working with large models or tensors (like in deep learning), waiting for the GC can lead to inefficiencies and OOM errors.
Explicitly calling del gives you precise control over when memory is released, which is particularly important in long-running processes like model training.
In the Notebook, you sometimes do
del
of either a local variable or a function's argument just beforereturn
.IMHO it does nothing there. Both of them are garbage collected exactly there, unconditionally.
The text was updated successfully, but these errors were encountered: