Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MUL operator to relay tflite frontend #3304

Merged
merged 1 commit into from
Jun 9, 2019

Conversation

apivovarov
Copy link
Contributor

@apivovarov apivovarov commented Jun 6, 2019

MUL operator is used in TFLite SSD Resnet 50 model (ssd_resnet_50_fpn_coco).
Model graph: ssd_resnet_50_fpn_coco.tflite.pdf

### ssd_resnet_50_fpn_coco summary:
# op_id: op_name - count
 0: ADD - 58
 2: CONCATENATION - 2
 3: CONV_2D - 110
14: LOGISTIC - 1
17: MAX_POOL_2D - 4
18: MUL - 42
22: RESHAPE - 14
32: CUSTOM - 1
34: PAD - 1

This PR transforms existing convert_add method to generic _convert_elemwise method (similar approach is used in tensorflow frontend code)
Existing convert_add and new convert_mul methods use _convert_elemwise method now.

I also created _test_elemwise method based on existing _test_add method.
Both _test_add and _test_mul use _test_elemwise method now

@@ -24,7 +24,6 @@
import numpy as np
import tvm
from tvm import relay
from tvm.contrib import util
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Import is not used. I deleted it

@@ -144,8 +143,6 @@ def compare_tflite_with_tvm(in_data, in_name, input_tensors,
for i in range(len(tflite_output)):
tvm.testing.assert_allclose(tflite_output[i], tvm_output[i], atol=1e-5, rtol=1e-5)

sess.close()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

line 127 opens new with tf.Session() as sess: context block.
After python finishes with tf.Session block execution it callssess.__exit__() method automatically which calls self.close() to close the session.
We do not need to close sess explicitly.

@apivovarov
Copy link
Contributor Author

@srkreddy1238 @jroesch @FrozenGene Can you have a look?

@tqchen
Copy link
Member

tqchen commented Jun 7, 2019

@kevinthesun please manage the PR

Copy link
Member

@yongwww yongwww left a comment

Choose a reason for hiding this comment

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

LGTM

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.

5 participants