Skip to content

Conversation

@neil-tan
Copy link
Member

@neil-tan neil-tan commented Apr 12, 2020

uTensor frontend that imports .tflite to ugraph.
Main file: utensor_cgen/frontend/tflite.py

Currently supported op:

QUANTIZE
DEPTHWISE_CONV_2D
MAX_POOL_2D
RESHAPE
FULLY_CONNECTED
DEQUANTIZE
ARG_MAX

The code-snippet for training and exporting the .tflite file:

converter = tf.lite.TFLiteConverter.from_saved_model('saved_model/test_model')
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_dataset_gen
tflite_model = converter.convert()

Test command:
utensor-cli convert converted_model.tflite

.toml modification:
transform_methods = [ "dropout(name_pattern=r'(dropout[_\\w\\d]*)/.*')", "graph_viz", ]

The test .tflite file will be kept available here until the PR is merged.

Copy link
Member

@dboyliao dboyliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please remove unused imports.
  2. There are return type inconsistency in your op options parsing function and it should not work.
  3. Please provide at least one test for your parser
  4. The model file downloadable in your PR description looks like a normal model instead of a quantized one. That's the reason why the parser works on that file since both quantize_op_data and dequantize_op_data are not called. Please double check the model file.

@dboyliao
Copy link
Member

Screen Shot 2020-04-23 at 3 23 35 PM

BTW, the op's names look weird.

@dboyliao
Copy link
Member

dboyliao commented Apr 23, 2020

@neil-tan
I fix the b' prefix issue.
However, I'd like you to remove the :0 from the op names.
Screen Shot 2020-04-23 at 3 34 44 PM

@dboyliao
Copy link
Member

Looks good to me.
Merge

@dboyliao dboyliao merged commit 1da0d5b into onnx Apr 24, 2020
@dboyliao dboyliao deleted the f/tflite-parser branch April 24, 2020 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants