Created
June 8, 2024 10:38
-
-
Save berlinbrown/0a27f0d9e1eeef3ef87386202d824ae9 to your computer and use it in GitHub Desktop.
Example PyTorch
This file contains hidden or 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
# Pytorch examples | |
import torch | |
import numpy as np | |
import time | |
randint = torch.randint(-100, 100, (6, )) | |
randint | |
print(randint) | |
tensor = torch.tensor([ | |
[0.2, 0.2], | |
[1.2, 1.1], | |
[1.4, 1.5] | |
]) | |
print(tensor) | |
device = 'cuda' if torch.cuda.is_available() else 'cpu' | |
print(device) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment