Open seanshpark opened 4 years ago
From document examples,
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
model = tf.keras.Sequential()
model.add(layers.Embedding(input_dim=1000, output_dim=64, input_length=10))
model.add(layers.SimpleRNN(128))
save_path = "./generated"
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.allow_custom_ops = True
tflite_model = converter.convert()
tflite_file = save_path + '/rnn_keras_02.tflite'
open(tflite_file, "wb").write(tflite_model)
will create an tflite file but with these Ops
[0] RESHAPE (code: 22, version: 1)
[1] CUSTOM(TensorListFromTensor) (code: 32, version: 1)
[2] CUSTOM(TensorListReserve) (code: 32, version: 1)
[3] CUSTOM(TensorListStack) (code: 32, version: 1)
[4] CUSTOM(While) (code: 32, version: 1)
[5] GATHER (code: 36, version: 1)
[6] STRIDED_SLICE (code: 45, version: 1)
[7] CAST (code: 53, version: 1)
For #1167