You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/06/03 18:39:05 UTC

[GitHub] [incubator-tvm] inadob opened a new pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

inadob opened a new pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805


   **This patch is made on top of #4789.** 
   * Add helper functions in the parser to quantize and dequantize with Relay
   * Add qnn tests for all 4 activation functions


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] tqchen commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-618773667


   ping


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 merged pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 merged pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob edited a comment on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob edited a comment on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-636551467


   > Ping @inadob Let us know if you are working on this. Or else I can take a chance at this.
   
   @anijain2305 Yes, I am working on it - I will be ready in the next few days. Sorry for the delay 
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-638984870


   @inadob Your changes look better now. Can you please rebase? (`git submodule update --init --recursive`)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-636551467


   > Ping @inadob Let us know if you are working on this. Or else I can take a chance at this.
   @anijain2305 Yes, I am working on it - I will be ready in the next few days. Sorry for the delay 
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-644883995


   @anijain2305 
   CI has been fixed :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob closed pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob closed pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-644898790


   Thanks @inadob This is merged!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-644882678


   > Ping @inadob :)
   
   Fixed it. :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] tqchen commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-643335059


   Glad that it is moving, @anijain2305 please manage this PR


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on a change in pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on a change in pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#discussion_r420254831



##########
File path: python/tvm/relay/frontend/tflite.py
##########
@@ -463,6 +484,114 @@ def convert_relu(self, op):
 
         return out
 
+    def convert_relu6(self, op):
+        """Convert TFLite ReLU6"""
+        try:
+            from tflite.Operator import Operator
+        except ImportError:
+            raise ImportError("The tflite package must be installed")
+
+        assert isinstance(op, Operator)
+        input_tensors = self.get_input_tensors(op)
+        assert len(input_tensors) == 1, "input tensors length should be 1"
+        input_tensor = input_tensors[0]
+        in_expr = self.get_expr(input_tensor.tensor_idx)
+
+        output_tensors = self.get_output_tensors(op)
+        assert len(output_tensors) == 1, "output tensors length should be 1"
+        output_tensor = output_tensors[0]
+
+        if input_tensor.qnn_params:
+            in_expr = self.dequantize(in_expr, input_tensor)
+        out = _op.clip(in_expr, a_min=0, a_max=6)
+        if output_tensor.qnn_params:
+            out = self.quantize(out, output_tensor)

Review comment:
       This is expensive. Lets try this https://github.com/apache/incubator-tvm/pull/5479/files




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-636251657


   Ping @inadob Let us know if you are working on this. Or else I can take a chance at this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 edited a comment on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 edited a comment on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-624168410


   Sorry for the delay. @inadob Can you take a look at this PR - https://github.com/apache/incubator-tvm/pull/5479
   
   I have added support for fused quantized activations there. We dont need to create a new op in C++ from scratch. It is pretty easy to do the same thing in python. Let me know what you think


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-639071565


   It seems you still have old `3rdparty/dmlc-core'. You can check that by clicking on "Files changed" tab.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-641651237


   Ping @inadob :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob removed a comment on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob removed a comment on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-644882678


   > Ping @inadob :)
   
   Fixed it. :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-639512065


   > It seems you still have old `3rdparty/dmlc-core'. You can check that by clicking on "Files changed" tab.
   
   It's fixed now. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-624168410


   Sorry for the delay. @inadob Can you take a look at this PR - https://github.com/apache/incubator-tvm/pull/5479
   
   I have added support for quantized activations there. We dont need to create a new op in C++ from scratch. It is pretty easy to do the same thing in python. Let me know what you think


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] anijain2305 commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
anijain2305 commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-639835635


   @inadob Can you please fix the CI error?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] inadob commented on pull request #4805: [Frontend][TFlite] Add parser support for relu6, leaky_relu, relu_n1_to_1, log_softmax

Posted by GitBox <gi...@apache.org>.
inadob commented on pull request #4805:
URL: https://github.com/apache/incubator-tvm/pull/4805#issuecomment-620736019


   @anijain can you please help me with the quantized operators


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org