larq.models.summary(model, print_fn=None, include_macs=True)
Prints a string summary of the network.
The summary includes the following information per layer:
- input precision,
- output dimension,
- weight count (broken down by bidtwidth),
- memory footprint in kilobytes (
8*10241-bit weights = 1 kB),
- number of multiply-accumulate (MAC) operations broken down by precision (optional & expermental).
A single MAC operation contains both a multiplication and an addition. The precision of a MAC operation is defined as the maximum bitwidth of its inputs.
Additionally, the following overall statistics for the model are supplied:
- total number of weights,
- total number of trainable weights,
- total number of non-trainable weights,
- model size,
- model size (8-bit FP weights): memory footprint if FP weights were 8 bit,
- float-32 equivalent size: memory footprint if all weights were 32 bit,
- compression ratio achieved by quantizing weights,
- total number of MAC operations,
- ratio of MAC operations that is binarized and can be accelated with XNOR-gates.
tf.keras.models.Model: model instance.
Callable[str, Any]: Print function to use. Defaults to
bool: whether or not to include the number of MAC-operations in the summary.
- ValueError: if called before the model is built.