-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Conversation
Some of the operations already exist in another PR #4805 |
@inadob thanks for letting me know., i didnt noticed, i will update my PR. |
There was a problem hiding this 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'): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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""" |
There was a problem hiding this comment.
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.
dc4b9dd
to
c77d4ce
Compare
c77d4ce
to
0508c26
Compare
Rebased to latest. |
'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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Thanks, it is merged |
* [TFLITE]elu, leaky_relu, lrn, log_softmax activation functions * removed ops present in pr 4805 * review_comments updated
* [TFLITE]elu, leaky_relu, lrn, log_softmax activation functions * removed ops present in pr 4805 * review_comments updated
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.