onnx / keras-onnx

Convert tf.keras/Keras models to ONNX
Apache License 2.0
381 stars 109 forks source link

'KerasTensor' object has no attribute 'graph' #724

Open hexate opened 3 years ago

hexate commented 3 years ago

I am having an issue when trying to convert my model to onnx.

I see this error: 'KerasTensor' object has no attribute 'graph'

while trying to run this: onnx_model = keras2onnx.convert_keras(model, model.name)

It worked fine with tf 2.3, but it was running on CPU. I upgraded to tf 2.5, and the model trains on GPU now, but my script fails when trying to export to Onnx. I am working with an LSTM model.

versions: Python: 3.8.10 (default, May 19 2021, 13:12:57) [MSC v.1916 64 bit (AMD64)] Tensorflow Gpu Version: 2.5.0 Keras Version: 2.5.0 Hub Version: 0.12.0 Datasets Version: 4.3.0 cuDNN version: 64_8 Cuda version: 64_112

LaCandela commented 3 years ago

Same here. I used TF v2.3 instead of v2.5, that solved the issue but now I cannot use the GPU...