You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "ashutosh-arm (via GitHub)" <gi...@apache.org> on 2023/01/26 17:41:24 UTC

[GitHub] [tvm] ashutosh-arm opened a new pull request, #13848: [ETHOSN] Apply FoldConstant before NPU partitioning

ashutosh-arm opened a new pull request, #13848:
URL: https://github.com/apache/tvm/pull/13848

   Introduced FoldConstant before NPU partitioning. Added a qnn.add test where both inputs are constants. Updated the number of operators remaining in the host code for ssd_mobilenet_v1 as the FoldConstant reduces the number of operators.
   
   cc @lhutton1 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] lhutton1 merged pull request #13848: [ETHOSN] Apply FoldConstant before NPU partitioning

Posted by "lhutton1 (via GitHub)" <gi...@apache.org>.
lhutton1 merged PR #13848:
URL: https://github.com/apache/tvm/pull/13848


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] tvm-bot commented on pull request #13848: [ETHOSN] Apply FoldConstant before NPU partitioning

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #13848:
URL: https://github.com/apache/tvm/pull/13848#issuecomment-1405365678

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * cc @lhutton1 <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] lhutton1 commented on pull request #13848: [ETHOSN] Apply FoldConstant before NPU partitioning

Posted by "lhutton1 (via GitHub)" <gi...@apache.org>.
lhutton1 commented on PR #13848:
URL: https://github.com/apache/tvm/pull/13848#issuecomment-1406232857

   Thanks @ashutosh-arm!


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] lhutton1 commented on a diff in pull request #13848: [ETHOSN] Apply FoldConstant before NPU partitioning

Posted by "lhutton1 (via GitHub)" <gi...@apache.org>.
lhutton1 commented on code in PR #13848:
URL: https://github.com/apache/tvm/pull/13848#discussion_r1088297238


##########
tests/python/contrib/test_ethosn/test_addition.py:
##########
@@ -41,20 +41,28 @@ def _get_model(
 ):
     """Return a model and any parameters it may have"""
 
-    iinfo = np.iinfo(dtype)
-    data_min = iinfo.min
-    data_max = iinfo.max
+    def create_or_assign_constant(shape, dtype, default_data):
+        """Creates new numpy array or assigns default_data if available."""
+
+        iinfo = np.iinfo(dtype)
+        data_min = iinfo.min
+        data_max = iinfo.max
+
+        nparray = None
+        if default_data:
+            nparray = np.array(default_data, dtype=dtype).reshape(shape)
+        else:
+            nparray = np.random.randint(data_min, data_max + 1, size=shape, dtype=dtype)
+
+        return relay.const(nparray, dtype=dtype)
 
     if lhs_is_constant:
-        a_data = np.array(constant_data, dtype=dtype).reshape(lhs_shape)
-        a = relay.const(a_data, dtype=dtype)
+        a = create_or_assign_constant(lhs_shape, dtype, constant_data)
     else:
         a = relay.var("a", shape=lhs_shape, dtype=dtype)
 
     if rhs_is_constant:
-        b_data = np.array(constant_data, dtype=dtype).reshape(rhs_shape)
-        np.random.randint(data_min, data_max + 1, size=rhs_shape, dtype=dtype)

Review Comment:
   Thanks for fixing this - looks much better! 



##########
tests/python/contrib/test_ethosn/test_networks.py:
##########
@@ -218,6 +218,6 @@ def test_ssd_mobilenet_v1():
         input_dict={"normalized_input_image_tensor": (1, 300, 300, 3)},
         compile_hash=_compile_hash,
         output_count=4,
-        host_ops=26,
+        host_ops=14,

Review Comment:
   😱



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

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