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/12/01 20:26:13 UTC

[GitHub] [tvm] anijain2305 opened a new pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

anijain2305 opened a new pull request #7009:
URL: https://github.com/apache/tvm/pull/7009


   @kevinthesun @zhiics @giuseros 
   
   TFLite prequantized Resent model was failing to compile. I found that the pad calculation introduce int64 datatype in the shape of max pool2d, that later causes issues with tensorization. Int64 was introduced because of the calculation between python int and np.int32, which results in np.int64. This PR ensures that all the padding calculations happen in python int.
   
   Additionally, I have added a small check to print i64 in AsText. This helped in identifying which op was introducing the int64 datatype.


----------------------------------------------------------------
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] [tvm] merrymercy commented on pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
merrymercy commented on pull request #7009:
URL: https://github.com/apache/tvm/pull/7009#issuecomment-738542246


   #7030 solves the same problem. But the modification of `AsText` is nice.


----------------------------------------------------------------
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] [tvm] giuseros commented on a change in pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
giuseros commented on a change in pull request #7009:
URL: https://github.com/apache/tvm/pull/7009#discussion_r540240975



##########
File path: python/tvm/relay/frontend/tflite.py
##########
@@ -3210,7 +3210,7 @@ def get_pad_value(data, kernel, stride):
     """
 
     out = int(math.ceil(float(data) / float(stride)))
-    pad = max(0, (out - 1) * stride + kernel - data)
+    pad = max(0, (out - 1) * int(stride) + int(kernel) - int(data))

Review comment:
       Also, do we know why this fails with `int64`? AFAIU from your RFC: https://discuss.tvm.apache.org/t/int64-vs-int32-dtype-error/8555 this used to work before. 




----------------------------------------------------------------
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] [tvm] masahi closed pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
masahi closed pull request #7009:
URL: https://github.com/apache/tvm/pull/7009


   


-- 
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] merrymercy edited a comment on pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
merrymercy edited a comment on pull request #7009:
URL: https://github.com/apache/tvm/pull/7009#issuecomment-738542246


   I also found the same problem and sent #7030 to solve it. Your modification of `AsText` is nice.


----------------------------------------------------------------
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] [tvm] merrymercy edited a comment on pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
merrymercy edited a comment on pull request #7009:
URL: https://github.com/apache/tvm/pull/7009#issuecomment-738542246


   #7030 solves the same problem. The modification of `AsText` is nice.


----------------------------------------------------------------
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] [tvm] kevinthesun commented on a change in pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
kevinthesun commented on a change in pull request #7009:
URL: https://github.com/apache/tvm/pull/7009#discussion_r533703042



##########
File path: python/tvm/relay/frontend/tflite.py
##########
@@ -3210,7 +3210,7 @@ def get_pad_value(data, kernel, stride):
     """
 
     out = int(math.ceil(float(data) / float(stride)))
-    pad = max(0, (out - 1) * stride + kernel - data)
+    pad = max(0, (out - 1) * int(stride) + int(kernel) - int(data))

Review comment:
       Do we want to somehow test the compilation for skylake/cascadelake target?




----------------------------------------------------------------
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] [tvm] merrymercy edited a comment on pull request #7009: [TFLite] Bugfix - ensure pad calcalution to be in int32

Posted by GitBox <gi...@apache.org>.
merrymercy edited a comment on pull request #7009:
URL: https://github.com/apache/tvm/pull/7009#issuecomment-738542246


   I also found the same problem and sent #7030 to fix it. Your modification of `AsText` is nice.


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