Skip to content

Commit

Permalink
add noqa, fix protected variable issue
Browse files Browse the repository at this point in the history
pkgoogle committed Jan 29, 2025
1 parent 330e1ab commit 640ab11
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions keras_hub/src/models/mobilenet/mobilenet_backbone.py
Original file line number Diff line number Diff line change
@@ -684,7 +684,9 @@ def __init__(
),
kernel_size=stackwise_kernel_size[block][inverted_block],
stride=stackwise_num_strides[block][inverted_block],
squeeze_excite_ratio=stackwise_se_ratio[block][inverted_block],
squeeze_excite_ratio=stackwise_se_ratio[block][
inverted_block
],
activation=stackwise_activation[block][inverted_block],
padding=stackwise_padding[block][inverted_block],
name=f"block_{block + 1}_{inverted_block}",
@@ -695,7 +697,7 @@ def __init__(
activation="hard_swish",
name=f"block_{len(stackwise_num_blocks) + 1}_0",
)(x)
self.output_shape = keras.ops.shape(x)
_output_shape = keras.ops.shape(x)

super().__init__(inputs=image_input, outputs=x, **kwargs)

@@ -716,9 +718,10 @@ def __init__(
self.input_activation = keras.activations.get(input_activation)
self.output_activation = keras.activations.get(output_activation)
self.image_shape = image_shape
self._output_shape = _output_shape

def compute_output_shape(self, input_shape):
return self.output_shape
return self._output_shape

def get_config(self):
config = {
@@ -731,7 +734,7 @@ def get_config(self):
"stackwise_activation": self.stackwise_activation,
"stackwise_padding": self.stackwise_padding,
"image_shape": self.image_shape,
"output_shape": self.output_shape,
"_output_shape": self._output_shape,
"input_num_filters": self.input_num_filters,
"output_num_filters": self.output_num_filters,
"depthwise_filters": self.depthwise_filters,
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
from keras_hub.src.api_export import keras_hub_export
from keras_hub.src.models.image_classifier import ImageClassifier
from keras_hub.src.models.mobilenet.mobilenet_backbone import MobileNetBackbone
from keras_hub.src.models.mobilenet.mobilenet_image_classifier_preprocessor import (
from keras_hub.src.models.mobilenet.mobilenet_image_classifier_preprocessor import ( # noqa: E501
MobileNetImageClassifierPreprocessor,
)

0 comments on commit 640ab11

Please sign in to comment.