Skip to content
fn

set_mutation_on_saved_allowed

void set_mutation_on_saved_allowed(bool v)

Toggle the process-wide "allow mutation on saved tensors" flag.

Used by lucid.autograd.graph.allow_mutation_on_saved_tensors to let users opt into the unsafe contract that they will not mutate a saved tensor in a way that would corrupt the gradient.

Parameters

vbool
New state of the override. true disables version-counter checks; false re-enables them.

Notes

The flag is global to the process — there is no per-thread or per-graph scoping. The Python context manager is responsible for restoring the previous value on exit.