jikechao opened a new issue, #14721: URL: https://github.com/apache/tvm/issues/14721
### Expected behavior the predicted result in tvm should be the same as keras. ### Actual behavior inconsistent inference results between keras and tvm.  ### Steps to reproduce ``` 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, 1) input_data = np.random.random(input_shape) x = layers.Input(shape=input_shape[1:], dtype='float32') layer = keras.layers.Softmax() layer.set_weights(layer.get_weights()) y = layer(x) model = models.Model(x, y) # print(model.summary()) res_keras = model.predict(input_data) shape_dict = {'input_1': input_shape} mod, params = relay.frontend.from_keras(model, shape_dict) with tvm.transform.PassContext(opt_level=3): model = relay.build_module.create_executor("graph", mod, tvm.cpu(0), 'llvm', params).evaluate() res_tvm = model(tvm.nd.array(input_data.astype('float32'))).numpy() print('keras infer result:', res_keras) print('tvm infer result:', res_tvm) np.testing.assert_allclose(res_keras, res_tvm, atol=1e-3, rtol=1e-3) ``` * frontend:keras -- 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]
