jikechao opened a new pull request, #15334:
URL: https://github.com/apache/tvm/pull/15334
This PR fixes two bugs:
bug-1. fix a typo about the wrong API name in the test case.
bug-2. add an assertion to reject the invalid layer, which can be
constructed in the old version of Keras.
## Steps to reproduce to bug-2: (Keras <= 2.6)
```
import tvm
import tvm.relay as relay
import numpy as np
from tensorflow import keras
from tensorflow.keras import layers, models
input_shape = (1, 2, 4)
input_data = np.random.random(size=input_shape)
dtype = 'float32'
x = layers.Input(shape=input_shape[1:], dtype=dtype)
layer = keras.layers.LSTM(units=0) # invalid input but can not reject
in keras <= 2.4
layer.set_weights(layer.get_weights())
y = layer(x)
model = models.Model(x, y)
res_keras = model.predict(input_data)
print(model.summary())
res_keras2 = model(input_data)
shape_dict = {'input_1': input_shape}
mod, params = relay.frontend.from_keras(model, shape_dict)
print(mod)
```
--
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]