nncf icon indicating copy to clipboard operation
nncf copied to clipboard

Improve Tensor performance

Open AlexanderDokuchaev opened this issue 1 year ago • 1 comments

Changes

Add custom custom implementation of functools.singledispatch with custom arguments 'wrapper_type' to select wrapper function. Remove np.errstate from divide function because it degrades performance, to disable warning add disable_error_handling function.

Tested on run 1000 times tune_range function by cProfile.

calls time
develop 338187 0.167
remove np.errstate from div 262113 0.127
tensor_dispatch 241006 0.118

AlexanderDokuchaev avatar Nov 08 '23 20:11 AlexanderDokuchaev

Codecov Report

Merging #2255 (76654ca) into develop (51aac27) will decrease coverage by 0.04%. Report is 1 commits behind head on develop. The diff coverage is 88.52%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2255      +/-   ##
===========================================
- Coverage    90.70%   90.67%   -0.04%     
===========================================
  Files          485      486       +1     
  Lines        43601    43600       -1     
===========================================
- Hits         39549    39535      -14     
- Misses        4052     4065      +13     
Flag Coverage Δ
COMMON 15.72% <84.42%> (-0.03%) :arrow_down:
ONNX 33.80% <79.50%> (-0.02%) :arrow_down:
OPENVINO 38.57% <79.50%> (-0.02%) :arrow_down:
TENSORFLOW 30.05% <63.93%> (+<0.01%) :arrow_up:
TORCH 62.61% <88.52%> (-0.04%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
nncf/experimental/tensor/functions.py 100.00% <100.00%> (+0.75%) :arrow_up:
nncf/experimental/tensor/numpy_functions.py 100.00% <100.00%> (ø)
nncf/experimental/tensor/tensor.py 99.00% <100.00%> (-0.01%) :arrow_down:
nncf/experimental/tensor/torch_functions.py 98.01% <100.00%> (-0.18%) :arrow_down:
nncf/quantization/fake_quantize.py 94.78% <100.00%> (+0.04%) :arrow_up:
nncf/experimental/tensor/dispatcher.py 82.27% <82.27%> (ø)

... and 1 file with indirect coverage changes

codecov[bot] avatar Nov 08 '23 21:11 codecov[bot]