Skip to content

Conversation

@datumbox
Copy link
Contributor

@datumbox datumbox commented Nov 10, 2022

Related to #6818

Minor perf/code-quality improvement for adjust_saturation_image_tensor on uint8. I should have done it as part of #6933 which introduced the parameter but missed it. Floats remain unaffected:

[---------------- adjust_saturation_image_tensor cpu torch.float32 ---------------]
                         |  adjust_saturation_image_tensor old  |      fn2 new     
1 threads: ------------------------------------------------------------------------
      (16, 3, 400, 400)  |           14243 (+-425) us           |  14257 (+-265) us
      (3, 400, 400)      |            569 (+-  1) us            |   567 (+-  1) us 
6 threads: ------------------------------------------------------------------------
      (16, 3, 400, 400)  |           14924 (+-250) us           |  14919 (+-308) us
      (3, 400, 400)      |            805 (+- 11) us            |   802 (+- 10) us 

Times are in microseconds (us).

[-------------- adjust_saturation_image_tensor cuda torch.float32 --------------]
                         |  adjust_saturation_image_tensor old  |     fn2 new    
1 threads: ----------------------------------------------------------------------
      (16, 3, 400, 400)  |            198 (+-  0) us            |  198 (+-  0) us
      (3, 400, 400)      |             54 (+-  1) us            |   53 (+-  1) us
6 threads: ----------------------------------------------------------------------
      (16, 3, 400, 400)  |            198 (+-  0) us            |  198 (+-  0) us
      (3, 400, 400)      |             54 (+-  1) us            |   53 (+-  1) us

Times are in microseconds (us).

[---------------- adjust_saturation_image_tensor cpu torch.uint8 ---------------]
                         |  adjust_saturation_image_tensor old  |     fn2 new    
1 threads: ----------------------------------------------------------------------
      (16, 3, 400, 400)  |             28 (+-  0) ms            |   27 (+-  0) ms
      (3, 400, 400)      |              1 (+-  0) ms            |    1 (+-  0) ms
6 threads: ----------------------------------------------------------------------
      (16, 3, 400, 400)  |             32 (+-  0) ms            |   30 (+-  0) ms
      (3, 400, 400)      |              2 (+-  0) ms            |    2 (+-  0) ms

Times are in milliseconds (ms).

[--------------- adjust_saturation_image_tensor cuda torch.uint8 ---------------]
                         |  adjust_saturation_image_tensor old  |     fn2 new    
1 threads: ----------------------------------------------------------------------
      (16, 3, 400, 400)  |            245 (+-  0) us            |  241 (+-  0) us
      (3, 400, 400)      |             72 (+-  1) us            |   70 (+-  1) us
6 threads: ----------------------------------------------------------------------
      (16, 3, 400, 400)  |            246 (+-  0) us            |  241 (+-  0) us
      (3, 400, 400)      |             72 (+-  1) us            |   69 (+-  1) us

Times are in microseconds (us).

cc @vfdev-5 @bjuncek @pmeier

@datumbox datumbox requested a review from pmeier November 10, 2022 11:31
@datumbox datumbox changed the title Minor change on adjust_saturation_image_tensor uint8 [prototype] Minor change on adjust_saturation_image_tensor uint8 Nov 10, 2022
@datumbox datumbox requested a review from vfdev-5 November 10, 2022 11:35
Copy link
Contributor

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Vasilis!

@datumbox datumbox merged commit 0cc9080 into pytorch:main Nov 10, 2022
@datumbox datumbox deleted the perf/saturation branch November 10, 2022 13:42
facebook-github-bot pushed a commit that referenced this pull request Nov 14, 2022
Reviewed By: NicolasHug

Differential Revision: D41265192

fbshipit-source-id: 2f9b157934d97790082fac56bd300dc7be8f30cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants