View source on GitHub |
Default model transformations.
Inherits From: QuantizeLayoutTransform
tfmot.quantization.keras.experimental.default_n_bit.DefaultNBitQuantizeLayoutTransform(
num_bits_weight: int = 8, num_bits_activation: int = 8
)
Methods
apply
apply(
model, layer_quantize_map
)
Implement default 8-bit transforms.
Currently this means the following.
- Pull activations into layers, and apply fuse activations. (
- Modify range in incoming layers for Concat. (
- Fuse Conv2D/DepthwiseConv2D + BN into single layer.
Args | |
---|---|
model
|
Keras model to be quantized. |
layer_quantize_map
|
Map with keys as layer names, and values as dicts
containing custom QuantizeConfig s which may have been passed with
layers.
|
Returns | |
---|---|
(Transformed Keras model to better match TensorFlow Lite backend, updated layer quantize map.) |