qkeras.qdense_batchnorm

Fold batchnormalization with previous QDense layers.

Classes

QDenseBatchnorm(*args, **kwargs)

Implements a quantized Dense layer fused with Batchnorm.

class qkeras.qdense_batchnorm.QDenseBatchnorm(*args, **kwargs)[source]

Bases: QDense

Implements a quantized Dense layer fused with Batchnorm.

build(input_shape)[source]
call(inputs, training=None)[source]
get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_folded_weights()[source]

Function to get the batchnorm folded weights. This function converts the weights by folding batchnorm parameters into the weight of QDense. The high-level equation: W_fold = gamma * W / sqrt(variance + epsilon) bias_fold = gamma * (bias - moving_mean) / sqrt(variance + epsilon) + beta

get_quantization_config()[source]
get_quantizers()[source]
load_own_variables(store)[source]

Loads the state of the layer.

You can override this method to take full control of how the state of the layer is loaded upon calling keras.models.load_model().

Parameters:

store – Dict from which the state of the model will be loaded.

save_own_variables(store)[source]

Saves the state of the layer.

You can override this method to take full control of how the state of the layer is saved upon calling model.save().

Parameters:

store – Dict where the state of the model will be saved.