Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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",
)
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}"
)
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}",
)
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",
)