mygrad.mem_guard_on#

mygrad.mem_guard_on = <mygrad._utils.lock_management._WithMemGuard object>#

A context manager used to enable memory-locking behavior

Examples

>>> from mygrad import mem_guard_on
>>> with mem_guard_on:
...     # array-memory locking is turned on
...     pass
... # previous memory-locking behavior is restored

This can also be used as a decorator

>>> @mem_guard_on
>>> def f():
...     # array-memory locking is turned on within function
...     return