Skip to content

Conversation

@vfdev-5
Copy link
Contributor

@vfdev-5 vfdev-5 commented Oct 21, 2022

Results:

[---------------- Autocontrast cpu torch.uint8 ---------------]
                     |  autocontrast stable  |  autocontrast v2
1 threads: ----------------------------------------------------
      (3, 400, 400)  |          969          |        844      
6 threads: ----------------------------------------------------
      (3, 400, 400)  |          320          |        274      

Times are in microseconds (us).

[--------------- Autocontrast cuda torch.uint8 ---------------]
                     |  autocontrast stable  |  autocontrast v2
1 threads: ----------------------------------------------------
      (3, 400, 400)  |          200          |        150      
6 threads: ----------------------------------------------------
      (3, 400, 400)  |          201          |        149      

Times are in microseconds (us).

[--------------- Autocontrast cpu torch.float32 --------------]
                     |  autocontrast stable  |  autocontrast v2
1 threads: ----------------------------------------------------
      (3, 400, 400)  |          529          |        418      
6 threads: ----------------------------------------------------
      (3, 400, 400)  |          201          |        157      

Times are in microseconds (us).

[-------------- Autocontrast cuda torch.float32 --------------]
                     |  autocontrast stable  |  autocontrast v2
1 threads: ----------------------------------------------------
      (3, 400, 400)  |          166          |        115      
6 threads: ----------------------------------------------------
      (3, 400, 400)  |          165          |        114      

Times are in microseconds (us).

cc @datumbox @bjuncek @pmeier

Comment on lines +231 to +232
minimum = image.amin(dim=(-2, -1), keepdim=True).to(dtype)
maximum = image.amax(dim=(-2, -1), keepdim=True).to(dtype)
Copy link
Contributor Author

@vfdev-5 vfdev-5 Oct 21, 2022

Choose a reason for hiding this comment

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

We can't use torch.aminmax here as it does not support tuple of dims. Reshaping the input does not improve runtime.

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Just one question:

@datumbox datumbox merged commit 3dd2e3d into pytorch:main Oct 24, 2022
facebook-github-bot pushed a commit that referenced this pull request Oct 27, 2022
Summary:
* WIP

* Updates to speed up autocontrast

Reviewed By: YosuaMichael

Differential Revision: D40722901

fbshipit-source-id: 9bcf2acd0399bac541cf56a40771971b9ebaba79

Co-authored-by: Vasilis Vryniotis <[email protected]>
@vfdev-5 vfdev-5 deleted the proto-improve-autocontrast branch January 30, 2023 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants