tfmot.quantization.keras.QuantizeRegistry

ABC interface which specifies how layers should be quantized.

The Registry is designed to function as a repository of QuantizeConfigs linked to layers. The idea is that while applying quantization to the various layers within a Keras model, the registry can be used to query which QuantizeConfig can be used to quantize a specific layer. The QuantizeConfig itself contains information to quantize that specific layer.

We provide a default registry for built-in Keras layers, but implementing this interface allows users the ability to write their own custom registries specific to their needs. It can also be extended to be used for any Keras layer, such as custom Keras layers.

Methods

get_quantize_config

View source

Returns the quantization config for the given layer.

Args
layer input layer to return quantize config for.

Returns
Returns the QuantizeConfig for the given layer.