How to use ViViT
Preliminaries
ViViT’s computational tricks are performed during a backward pass with BackPACK. Hence, you must first extend your model and loss function.
Integration with BackPACK
Starting from a working backward pass with BackPACK, you can integrate ViViT as follows:
Instantiate the
...Computations
object for your quantity of interest (see available computations).Use that object to create the extension and extension hook for BackPACK. Pass them as arguments to your
with backpack(...)
context.Request the results from the
...Computations
object after the backward pass.
For examples see Code samples.