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

[TFLITE]Activation functions support #4978

Merged
merged 3 commits into from
Mar 11, 2020

Conversation

siju-samuel
Copy link
Member

ELU, LEAKY_RELY, LRN, LOG_SOFTMAX activation functions supported for tflite frontend.
Along with this PR, i sorted the op list of tflite.
@FrozenGene @anijain2305 @wyc-ruiker Please help to review. TIA

Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

@inadob
Copy link
Contributor

inadob commented Mar 2, 2020

Some of the operations already exist in another PR #4805

@siju-samuel
Copy link
Member Author

@inadob thanks for letting me know., i didnt noticed, i will update my PR.

Copy link
Contributor

@wyc-ruiker wyc-ruiker left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1688,6 +1715,9 @@ def test_forward_mediapipe_hand_landmark():
test_forward_prelu()
test_forward_fully_connected()
test_forward_l2_normalization()
# The below activations come with TFLite >= 1.14.0 fbs schema
if package_version.parse(tf.VERSION) >= package_version.parse('1.14.0'):
Copy link
Contributor

Choose a reason for hiding this comment

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

move the version check inside test_forward_local_response_normalization()

alpha = alpha * size
axis = 3 # NHWC format
out = _op.nn.lrn(in_expr, size=size, axis=axis, bias=bias, alpha=alpha, beta=beta)
return out
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to add an empty line before the return. The same applies to the rest of the functions.

@@ -685,6 +723,22 @@ def convert_neg(self, op):
'TFlite quantized NEG operator is not supported yet.')
return self._convert_unary_elemwise(_op.negative, op)

def convert_elu(self, op):
"""Convert TFLite ELU"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, add the necessary imports.

@siju-samuel
Copy link
Member Author

Rebased to latest.
@FrozenGene @anijain2305 please review and help to merge. TIA

Comment on lines +65 to +77
'ADD': self.convert_add,
'AVERAGE_POOL_2D': self.convert_average_pool2d,
'BATCH_TO_SPACE_ND': self.convert_batch_to_space_nd,
'CAST': self.convert_cast,
'CEIL': self.convert_ceil,
'CONCATENATION': self.convert_concatenation,
'CONV_2D': self.convert_conv2d,
'COS': self.convert_cos,
'DEPTHWISE_CONV_2D': self.convert_depthwise_conv2d,
'DETECTION_POSTPROCESS': self.convert_detection_postprocess,
'DIV': self.convert_div,
'ELU': self.convert_elu,
'EQUAL': self.convert_equal,
Copy link
Member

Choose a reason for hiding this comment

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

Do you change it as alphabetical order?

Copy link
Member Author

Choose a reason for hiding this comment

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

@FrozenGene Yes. its better to be in alphabetical order like TF. And it reduces the conflicts while merging PR.

@FrozenGene FrozenGene merged commit ab83993 into apache:master Mar 11, 2020
@FrozenGene
Copy link
Member

Thanks, it is merged

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Apr 16, 2020
* [TFLITE]elu, leaky_relu, lrn, log_softmax activation functions

* removed ops present in pr 4805

* review_comments updated
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Apr 17, 2020
* [TFLITE]elu, leaky_relu, lrn, log_softmax activation functions

* removed ops present in pr 4805

* review_comments updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants