Last active
May 20, 2024 10:06
-
-
Save shink/932e5c81a72823892bea7448ea8201fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
import torch | |
torch.set_default_device('cuda') | |
t1 = torch.tensor([1, 2, 3, 3, 4, 5, 6, 7, 8], dtype=torch.float) | |
res1 = torch.histc(t1, 5, 7, 7) | |
print(res1) | |
t2 = torch.tensor([7], dtype=torch.float) | |
res2 = torch.histc(t2, 5, 7, 7) | |
print(res2) | |
t3 = torch.tensor([1, 2, 3, 3, 4, 5, 6, 7, 8], dtype=torch.float) | |
res3 = torch.histc(t3, 5, 0, 0) | |
print(res3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment