Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fully_connected_block(self, x, units):
x = lq.layers.QuantDense(
units,
input_quantizer=self.input_quantizer,
kernel_quantizer=self.kernel_quantizer,
kernel_constraint=self.kernel_constraint,
use_bias=False,
)(x)
return tf.keras.layers.BatchNormalization(
scale=False, momentum=0.9, epsilon=1e-4
)(x)
import itertools
from dataclasses import dataclass
import numpy as np
import tensorflow.keras.layers as keras_layers
from terminaltables import AsciiTable
import larq.layers as lq_layers
__all__ = ["summary"]
op_count_supported_layer_types = (
lq_layers.QuantConv2D,
lq_layers.QuantSeparableConv2D,
lq_layers.QuantDepthwiseConv2D,
lq_layers.QuantDense,
keras_layers.Conv2D,
keras_layers.SeparableConv2D,
keras_layers.DepthwiseConv2D,
keras_layers.Dense,
keras_layers.Flatten,
keras_layers.BatchNormalization,
keras_layers.MaxPool2D,
keras_layers.AveragePooling2D,
)
mac_containing_layers = (
lq_layers.QuantConv2D,
lq_layers.QuantSeparableConv2D,
lq_layers.QuantDepthwiseConv2D,
lq_layers.QuantDense,
keras_layers.Conv2D,