ibsidorenko opened a new pull request, #13236:
URL: https://github.com/apache/tvm/pull/13236

   This commit adds SimplifyClipAndConsecutiveCast and SimplifyCastClip to 
SimplifyExpr Relay pass. These simplify sequence clip->cast->cast and 
cast->clip based on Clip min/max attributes and Cast target data type.
   
   1) SimplifyClipAndConsecutiveCast example:
      %0 == [type=int32]
      %1 = clip(%0, a_min=0f, a_max=255f) [type=int32]
      %2 = cast(%1, dtype="uint8") [type=uint8]
      %3 = cast(%2, dtype="int32") [type=int32]
   
      --> Here Clip dtype == Cast2 dtype and max_value("uint8") == 255
      min_value("uint8") == 0
   
      Optimized sequence (both casts can be removed):
      %1 = clip(%0, a_min=0f, a_max=255f) [type=int32]
   
   2) SimplifyCastClip example:
      %1 = cast(%0, dtype="uint8") [type=uint8]
      %2 = clip(%1, a_min=0f, a_max=255f) [type=int8]
   
      Optimized sequence (remove Clip):
      %1 = cast(%0, dtype="uint8") [type=uint8]


-- 
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-unsubscr...@tvm.apache.org

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

Reply via email to