cmendezc

NPU examples

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