How to use the larq.metrics.FlipRatio function in larq

To help you get started, we’ve selected a few larq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github larq / larq / larq / layers_base.py View on Github external
def build(self, input_shape):
        super().build(input_shape)
        if self.depthwise_quantizer:
            if "flip_ratio" in self._custom_metrics:
                self.depthwise_flip_ratio = lq_metrics.FlipRatio(
                    values_shape=self.depthwise_kernel.shape,
                    name=f"flip_ratio/{self.name}_depthwise",
                )
        if self.pointwise_quantizer:
            if "flip_ratio" in self._custom_metrics:
                self.pointwise_flip_ratio = lq_metrics.FlipRatio(
                    values_shape=self.pointwise_kernel.shape,
                    name=f"flip_ratio/{self.name}_pointwise",
                )
github larq / larq / larq / layers_base.py View on Github external
def build(self, input_shape):
        super().build(input_shape)
        if self.kernel_quantizer:
            if "flip_ratio" in self._custom_metrics:
                self.flip_ratio = lq_metrics.FlipRatio(
                    values_shape=self.kernel.shape, name=f"flip_ratio/{self.name}"
                )
github larq / larq / larq / layers_base.py View on Github external
def build(self, input_shape):
        super().build(input_shape)
        if self.depthwise_quantizer:
            if "flip_ratio" in self._custom_metrics:
                self.flip_ratio = lq_metrics.FlipRatio(
                    values_shape=self.depthwise_kernel.shape,
                    name=f"flip_ratio/{self.name}",
                )
github larq / larq / larq / layers_base.py View on Github external
def build(self, input_shape):
        super().build(input_shape)
        if self.depthwise_quantizer:
            if "flip_ratio" in self._custom_metrics:
                self.depthwise_flip_ratio = lq_metrics.FlipRatio(
                    values_shape=self.depthwise_kernel.shape,
                    name=f"flip_ratio/{self.name}_depthwise",
                )
        if self.pointwise_quantizer:
            if "flip_ratio" in self._custom_metrics:
                self.pointwise_flip_ratio = lq_metrics.FlipRatio(
                    values_shape=self.pointwise_kernel.shape,
                    name=f"flip_ratio/{self.name}_pointwise",
                )