save_intermediates

save_intermediates#

Utilities to capture and hold intermediate values as a model runs.

This module provides a layer SaveIntermediate that can be inserted into a model to capture the intermediate value passing through it when it runs. The value is stored as an attribute on the object and can be accessed later.

It also provides a utility saving_all_intermediates that copies a model and inserts new SaveIntermediate layers into it at every point.

Note that storing all of the intermediate activations for a large model may use a large amount of memory. This utility is intended primarily for debugging and analyzing small models and small parts of larger models. If you would like to just inspect the shapes of the activations, you can also use the SaveIntermediateShape layer instead.

Classes

SaveIntermediate

A layer that captures an intermediate value as it passes through.

SaveIntermediateShape

A layer that captures the shape of intermediate values passing through.

Functions

saving_all_intermediates(model[, ...])

Returns a copy of model with SaveIntermediate layers inserted.