qkeras.qconv2d_batchnorm

Fold batchnormalization with previous QConv2D layers.

Classes

QConv2DBatchnorm(*args, **kwargs)

Fold batchnormalization with a previous qconv2d layer.

class qkeras.qconv2d_batchnorm.QConv2DBatchnorm(*args, **kwargs)[source]

Bases: QConv2D

Fold batchnormalization with a previous qconv2d layer.

build(input_shape)[source]
call(inputs, training=False)[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 QConv2D. 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.