Showing
1 changed file
with
13 additions
and
0 deletions
ejemplo-npu/quick_verification_torch1.11.py
0 → 100644
1 | +import torch | ||
2 | +import torch_npu | ||
3 | + | ||
4 | +print("NPU available?", torch.npu.is_available()) | ||
5 | +print("Current device:", torch.npu.current_device()) | ||
6 | +device = torch.device("npu:0") | ||
7 | +# x = torch.randn(2, 2).npu() | ||
8 | +# y = torch.randn(2, 2).npu() | ||
9 | +x = torch.randn(2, 2).to(device) | ||
10 | +y = torch.randn(2, 2).to(device) | ||
11 | +z = x.mm(y) | ||
12 | + | ||
13 | +print(z) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment