Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
279 views
in Technique[技术] by (71.8m points)

In Tensorflow, I'm getting errors converting Google's BigTransfer model into Tensorflow Lite

I would like to use the model from Google's BigTransfer paper on device.

Paper: https://arxiv.org/abs/1912.11370

Code: https://github.com/google-research/big_transfer/blob/master/colabs/big_transfer_tf2.ipynb

Here is my TF Lite code:

def representative_data_gen():
  for x, _ in validation_ds.take(QUANTIZATION_REPRESENTATIVE_DATASET_SIZE):
    yield [x]
    
converter = tf.lite.TFLiteConverter.from_saved_model(MODEL_DIR)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen

tflite_model = converter.convert()

Here is the error I get:

<unknown>:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag):
        tf.SquaredDifference {device = ""}

It looks like Tensorflow Lite can't do group_norm because there are no ops for tf.SquaredDifference. Any ideas on how to convert Google's BiT model into Tensorflow Lite?

question from:https://stackoverflow.com/questions/65661737/in-tensorflow-im-getting-errors-converting-googles-bigtransfer-model-into-ten

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try using TF select ops. However, you may needs to ensure your TFLite interpreter has these select ops for inference.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...