Ask questionstflite crash with segmentfault when I use set_tensor to set input tensor.
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu16.04 windows and Raspbian 10
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: I test it both on x64 and armv7l (Raspberry Pi4 which is running 32bit OS)
TensorFlow installed from (source or binary): from binary
TensorFlow version (use command below): I test with 2.0 1.12
Python version: 3.7
Describe the current behavior As I use tf1.12 produce a saved_model.pb, I use tf2.0 to convert it to tflite file. But when I try to inference with tflite. it alway crash with segment fault when I try to set_tensor. I tried it on windows and linux and raspberry pi, all doesn't work.
I have test the saved_model.pb as it work well, so I think the it's not the model's problem.
Code to reproduce the issue I use the following code to convert the model to tflite: `import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model('./')
tflite_model = converter.convert()
and following code to inference: ` interpreter = tf.lite.Interpreter(model_path=model_path)
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
input_shape = input_details['shape']
input_data = np.array(np.random.random_sample(input_shape), dtype=np.float32)
result = interpreter.get_tensor(output_details['index']) ` it crash when interpreter.set_tensor I attach my model files here. https://drive.google.com/file/d/1NflTBZ2iB4hptDozODdaSke4o7pzPBNW/view?usp=sharing The original code is to long, if needed I can upload it later.
Answer questions aselle
I also submitted a fix (above) 5521416 so this warns you that allocate needs to be called first.