facebookresearch / diffkt

A framework for automatic differentiation in Kotlin
MIT License
60 stars 6 forks source link

In tracing tensors, clear temporaries after last use #31

Open gafter opened 2 years ago

gafter commented 2 years ago

When we generate tracing tensors, we produce temporary variables for intermediate values that are reused. We should clear the variable after its last use. This isn't so important in the printed form, but more important when evaluating the tracing tensor, as clearing the temporaries will reduce the memory consumption.