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/01/29 23:16:01 UTC

[GitHub] [incubator-tvm] huajsj opened a new pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.

huajsj opened a new pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791
 
 
   some hardware accelerator ask packed format data like NCHWinic to fit the
   hardware resource, here add 'upsample' 'NCHWinic' format support to help
   such requirement.

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tmoreau89 commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
tmoreau89 commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#issuecomment-581581745
 
 
   Thanks @huajsj @Laurawly @jwfromm the PR has been 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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tmoreau89 commented on a change in pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
tmoreau89 commented on a change in pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#discussion_r373658550
 
 

 ##########
 File path: topi/python/topi/image/resize.py
 ##########
 @@ -18,8 +18,37 @@
 """TVM operator input resize compute."""
 from __future__ import absolute_import
 import tvm
+from topi.util import nchw_pack_layout, nchw_xc_layout
 from .. import tag
 
+def get_2d_indices(indices, layout='NCHW'):
+    """ Get 2d indices """
+    (cc, inum, ic) = (0, 0, 0)
+    if layout == 'NHWC':
+        n, y, x, c = indices
+        cc = None
+    elif layout == 'NCHW':
+        n, c, y, x = indices
+        cc = None
+    elif nchw_pack_layout(layout):
+        n, c, y, x, inum, ic = indices
+    else:
+        n, c, y, x, cc = indices
+    return n, c, y, x, cc, inum, ic
+
+def get_2d_pixel(data, layout, boxes, image_height, image_width, n, c, y, x, cc, ib, ic):
+    """ Get 2d pixel """
+    if boxes is None:
+        y = tvm.max(tvm.min(y, image_height - 1), 0)
+        x = tvm.max(tvm.min(x, image_width - 1), 0)
+    if layout == 'NHWC':
+        return data(n, y, x, c).astype('float')
+    if layout == 'NCHW':
+        return data(n, c, y, x).astype('float')
+    if nchw_pack_layout(layout):
+        return data(n, c, y, x, ib, ic).astype('float')
+    # else must be NCHWxc
 
 Review comment:
   can we assert 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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tmoreau89 merged pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
tmoreau89 merged pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] huajsj commented on a change in pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
huajsj commented on a change in pull request #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#discussion_r373667310
 
 

 ##########
 File path: topi/python/topi/image/resize.py
 ##########
 @@ -18,8 +18,37 @@
 """TVM operator input resize compute."""
 from __future__ import absolute_import
 import tvm
+from topi.util import nchw_pack_layout, nchw_xc_layout
 from .. import tag
 
+def get_2d_indices(indices, layout='NCHW'):
+    """ Get 2d indices """
+    (cc, inum, ic) = (0, 0, 0)
+    if layout == 'NHWC':
+        n, y, x, c = indices
+        cc = None
+    elif layout == 'NCHW':
+        n, c, y, x = indices
+        cc = None
+    elif nchw_pack_layout(layout):
+        n, c, y, x, inum, ic = indices
+    else:
+        n, c, y, x, cc = indices
+    return n, c, y, x, cc, inum, ic
+
+def get_2d_pixel(data, layout, boxes, image_height, image_width, n, c, y, x, cc, ib, ic):
+    """ Get 2d pixel """
+    if boxes is None:
+        y = tvm.max(tvm.min(y, image_height - 1), 0)
+        x = tvm.max(tvm.min(x, image_width - 1), 0)
+    if layout == 'NHWC':
+        return data(n, y, x, c).astype('float')
+    if layout == 'NCHW':
+        return data(n, c, y, x).astype('float')
+    if nchw_pack_layout(layout):
+        return data(n, c, y, x, ib, ic).astype('float')
+    # else must be NCHWxc
 
 Review comment:
   Hi @tmoreau89 , thanks for the follow up, sure, issue just 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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] huajsj commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
huajsj commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#issuecomment-580493189
 
 
   Hi @Laurawly @Huyuwei , could you help for the review thanks.

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tmoreau89 commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
tmoreau89 commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#issuecomment-580886430
 
 
   @srkreddy1238 could you help review?

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] huajsj commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
huajsj commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#issuecomment-580881788
 
 
   Hi @tmoreau89 , this patch related to let VTA to support Yolov3, if you have time could you help for a review too?

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


With regards,
Apache Git Services

[GitHub] [incubator-tvm] huajsj commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.

Posted by GitBox <gi...@apache.org>.
huajsj commented on issue #4791: [TOPI] upsample operator 'NCHWinic' format support.
URL: https://github.com/apache/incubator-tvm/pull/4791#issuecomment-580885374
 
 
   Hi @jwfromm, if you have time could you help for a review? thanks.

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


With regards,
Apache Git Services