trevor-m opened a new pull request #7949:
URL: https://github.com/apache/tvm/pull/7949
Keras models can have nested layers, where one layer in the model is
actually another Keras model with it's own layers. With this PR, we will now
support these types of models in TVM.
Example Keras model with nested model "mobilenetv2_1.00_224".
```
Layer (type) Output Shape Param #
=================================================================
mobilenetv2_1.00_224 (Functi (None, 7, 7, 1280) 2257984
_________________________________________________________________
global_average_pooling2d_1 ( (None, 1280) 0
_________________________________________________________________
dense_2 (Dense) (None, 1024) 1311744
_________________________________________________________________
dense_3 (Dense) (None, 2) 2050
=================================================================
Total params: 3,571,778
Trainable params: 3,537,666
Non-trainable params: 34,112
_________________________________________________________________
```
It can be created using the following Keras code, which is commonly used
when using pretained models.
```
sub_model = keras.applications.MobileNetV2(input_shape=(224, 224, 3),
include_top=False)
keras_model = keras.Sequential(
[
sub_model,
keras.layers.GlobalAveragePooling2D(),
keras.layers.Dense(1024),
keras.layers.Dense(2),
]
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]