# larq.models¶

## summary¶

```
summary(model, print_fn=<built-in function print>, include_macs=True)
```

The summary includes the following information per layer:

- input precision,
- output dimension,
- weight count (broken down by bidtwidth),
- memory footprint in kilobytes (
`8*1024`

1-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.

**Arguments**

`model`

:`tf.keras`

model instance.`print_fn`

: Print function to use. Defaults to`print`

. You can set it to a custom function in order to capture the string summary.`include_macs`

: whether or not to include the number of MAC-operations in the summary.

**Raises**

**ValueError**: if called before the model is built.