Inside the expectation function in the EnergyInference class, I needed to add persistent=True to values_tape. This was to get persistence to work in gradient tapes that wrap calls to expectation. However, if persistence=False in the enclosing tape, might be more memory efficient to remove persistence here. So this issue is to find a way to detect the persistence of the enclosing tape and adjust accordingly.
Inside the
expectation
function in theEnergyInference
class, I needed to addpersistent=True
tovalues_tape
. This was to get persistence to work in gradient tapes that wrap calls toexpectation
. However, ifpersistence=False
in the enclosing tape, might be more memory efficient to remove persistence here. So this issue is to find a way to detect the persistence of the enclosing tape and adjust accordingly.