jikechao commented on code in PR #14707:
URL: https://github.com/apache/tvm/pull/14707#discussion_r1174913581
##########
tests/python/frontend/keras/test_forward.py:
##########
@@ -209,6 +211,15 @@ def test_forward_activations(self, keras_mod):
keras_model = keras_mod.models.Model(data, x)
verify_keras_frontend(keras_model)
verify_keras_frontend(keras_model, need_transpose=False,
layout="NHWC")
+ # test invalid attribute alpha=None for LeakyReLU
+ if package_version.parse(keras_mod.__version__.split("-tf")[0]) <=
package_version.parse(
+ "2.3.1"
+ ):
Review Comment:
The following model is generated using keras (version 2.2) with the script.
However, this model is not a valid model, which should be rejected in TVM
front-end checking.
```
input_shape = (2, 3, 4)
input_data = np.random.random(input_shape)
x = layers.Input(shape=input_shape[1:], dtype='float32')
layer = keras.layers.LeakyReLU(alpha=None)
layer.set_weights(layer.get_weights())
y = layer(x)
model = models.Model(x, y)
```

However, in the latest keras. Keras found
`keras.layers.LeakyReLU(alpha=None)` is not a valid usage and added an
exception value checking to avoid generating the invalid model ([see this
issue](https://github.com/tensorflow/tensorflow/pull/47017)). Thus, for
triggering this crash, we should use keras <=2.3.1.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]