Repository: keras-team/keras
Issue: MobileNetV3 models can't infer the static shape

**System information**.
- Have I written custom code (as opposed to using a stock example script provided in Keras): no
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): any
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 2.6.0
- Python version: 3.8
- Bazel version (if compiling from source): no
- GPU model and memory: no
- Exact command to reproduce:
https://colab.research.google.com/drive/1geUcvgluev88zRG-hGhRgJ4YbaA6pt2Y?usp=sharing

**Describe the problem**.
MobileNetV3 models can't estimate output shape of the intermediate layers because some functions (activations like hard_swith, i suppose) did not wrapped with layers.

**Describe the current behavior**.
Exception raised when `compute_output_shape` executed.

**Describe the expected behavior**.
Just like ALL other models in `keras.applications`, MobileNetV3* models should be able to compute their output shapes.

**[Contributing](https://github.com/keras-team/keras/blob/master/CONTRIBUTING.md)**.

- Do you want to contribute a PR? (yes/no): no
- If yes, please read [this page](https://github.com/keras-team/keras/blob/master/CONTRIBUTING.md) for instructions
- Briefly describe your candidate solution(if contributing): no

**Standalone code to reproduce the issue**.

Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/Jupyter/any notebook.


**Source code / logs**.
```python
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in compute_output_shape(self, input_shape)
    782         try:
--> 783           outputs = self(inputs, training=False)
    784         except TypeError as e:

9 frames
/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
    976       return self._functional_construction_call(inputs, args, kwargs,
--> 977                                                 input_list)
    978 

/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
   1114       outputs = self._keras_tensor_symbolic_call(
-> 1115           inputs, input_masks, args, kwargs)
   1116 

/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in _keras_tensor_symbolic_call(self, inputs, input_masks, args, kwargs)
    847     else:
--> 848       return self._infer_output_signature(inputs, args, kwargs, input_masks)
    849 

/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in _infer_output_signature(self, inputs, args, kwargs, input_masks)
    887           inputs = self._maybe_cast_inputs(inputs)
--> 888           outputs = call_fn(inputs, *args, **kwargs)
    889 

/usr/local/lib/python3.7/dist-packages/keras/layers/core.py in _call_wrapper(*args, **kwargs)
   1349     def _call_wrapper(*args, **kwargs):
-> 1350       return self._call_wrapper(*args, **kwargs)
   1351     self.call = tf.__internal__.decorator.make_decorator(function, _call_wrapper)

/usr/local/lib/python3.7/dist-packages/keras/layers/core.py in _call_wrapper(self, *args, **kwargs)
   1381       kwargs.pop('name', None)
-> 1382       result = self.function(*args, **kwargs)
   1383     self._check_variables(created_variables, tape.watched_variables())

/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
    205     try:
--> 206       return target(*args, **kwargs)
    207     except (TypeError, ValueError):

TypeError: _add_dispatch() missing 1 required positional argument: 'y'

The above exception was the direct cause of the following exception:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-3-fe10d8214bfb> in <module>()
      1 base_model = mobilenet_v3.MobileNetV3Large(include_top=False, weights=None)
----> 2 base_model.compute_output_shape(input_shape=[224, 224, 3])

/usr/local/lib/python3.7/dist-packages/keras/engine/functional.py in compute_output_shape(self, input_shape)
    468           layer_input_shapes = tf_utils.convert_shapes(
    469               layer_input_shapes, to_tuples=True)
--> 470           layer_output_shapes = layer.compute_output_shape(layer_input_shapes)
    471           # Convert back to TensorShapes.
    472           layer_output_shapes = tf_utils.convert_shapes(

/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in compute_output_shape(self, input_shape)
    787               'layer\\'s output. Please implement the '
    788               '`compute_output_shape` method on your layer (%s).' %
--> 789               self.__class__.__name__) from e
    790       return tf.nest.map_structure(lambda t: t.shape, outputs)
    791     raise NotImplementedError(

NotImplementedError: We could not automatically infer the static shape of the layer's output. Please implement the `compute_output_shape` method on your layer (TFOpLambda).
```


Changed files:
keras/applications/mobilenet_v3.py

diff --git a/keras/applications/mobilenet_v3.py b/keras/applications/mobilenet_v3.py
index b79c4a6636..80722276cd 100644
--- a/keras/applications/mobilenet_v3.py
+++ b/keras/applications/mobilenet_v3.py
@@ -555,7 +555,7 @@ def relu(x):
 
 
 def hard_sigmoid(x):
-    return layers.ReLU(6.0)(x + 3.0) * (1.0 / 6.0)
+    return layers.Activation("hard_sigmoid")(x)
 
 
 def hard_swish(x):