Created
November 22, 2024 22:08
-
-
Save brando90/bb3b86cd968d93b3dd79db671a68859f to your computer and use it in GitHub Desktop.
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
import torch | |
# Create two matrices on the GPU | |
matrix_a = torch.rand((1000, 1000), device='cuda') | |
matrix_b = torch.rand((1000, 1000), device='cuda') | |
# Perform matrix sum | |
result = matrix_a + matrix_b | |
# Verify and print device of the result | |
print(f"Result is on device: {result.device}") | |
print(f"First element of result: {result[0, 0]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://chatgpt.com/c/674100b2-8228-8001-9679-8dc13695447e