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 2021/09/22 07:22:45 UTC

[GitHub] [tvm] wangxiang2713 opened a new pull request #9073: Skip numpy.ascontiguousarray if C_CONTIGUOUS == True

wangxiang2713 opened a new pull request #9073:
URL: https://github.com/apache/tvm/pull/9073


   Hi, i just run a tensorflow model with TVM. My model has 317 inputs so i find create NDArray inputs for model is time consuming. 
   
   Code:
   ```
   source_array = np.ascontiguousarray(
       source_array, dtype="uint16" if dtype == "bfloat16" else dtype
   )
   ```
   is used in function NDArray.copyfrom when create NDArray from Numpy. I find this code cost 0.47ms for my model, but a numpy array without operation like slice is contiguous and ascontiguousarray is not needed. In fact this code do nothing in my case, but 0.47ms is used.
   
   So i add a type check, and i use a table DataType.NUMPY2STR to avoid str(np.dtype) as i find it time comusing, as i do in commit: https://github.com/apache/tvm/pull/9072
   
   
   
   
   If dtype is numpy.dtype, function DataType will convert it to str, and i find this convert is time consuming, about 0.83ms for my model. 
   
   So i use a table to avoid convert numpy.dtype to str.


-- 
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] tqchen commented on pull request #9073: [PYTHON][FFI] Skip numpy.ascontiguousarray if C_CONTIGUOUS == True

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


   Thanks @wangxiang2713 


-- 
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] tqchen merged pull request #9073: [PYTHON][FFI] Skip numpy.ascontiguousarray if C_CONTIGUOUS == True

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #9073:
URL: https://github.com/apache/tvm/pull/9073


   


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