7 lines
177 B
Python
7 lines
177 B
Python
|
import torch
|
||
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||
|
tensor = torch.randn(3, 3).to(device) # Moves the tensor to GPU
|
||
|
|
||
|
|
||
|
print(tensor)
|
||
|
print(device)
|