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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to