-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Migrate clamp from the TH to Aten (CUDA) #37646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
💊 Build failures summary and remediationsAs of commit 431540e (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 10 times. |
benchmarked with: import timeit
for n, t in [(10000, 10000),
(100000, 10000)]:
for dtype in ('torch.half', 'torch.float', 'torch.double'):
print(f'torch.clamp(a, 0.25, 0.75) a.numel() == {n} for {t} times {dtype}')
print(timeit.timeit(f'torch.clamp(a, 0.25, 0.75); torch.cuda.synchronize()',
setup=f'import torch; a=torch.randn({n}, dtype={dtype}, device="cuda")',
number=t))
for name in ('clamp_min', 'clamp_max'):
for n, t in [(10000, 10000),
(32767, 10000)]:
for dtype in ('torch.int16', 'torch.int32', 'torch.int64'):
print(f'torch.{name}(a, 5000) a.numel() == {n} for {t} times {dtype}')
print(timeit.timeit(f'torch.{name}(a, 5000); torch.cuda.synchronize()',
setup=f'import torch; a=torch.randint(0, {n}, ({n},), dtype={dtype}, device="cuda")',
number=t)) After port:
Original:
|
@VitalyFedyunin request for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@VitalyFedyunin merged this pull request in 12e6491. |
Summary: Fixed pytorch#24544 Reference pytorch#24507 Pull Request resolved: pytorch#37646 Differential Revision: D21395824 Pulled By: VitalyFedyunin fbshipit-source-id: 111889023d60e3361b5a646bcfb6fb7d5ec969d1
Fixed #24544
Reference #24507