demo 1
Browse files
app.py
CHANGED
@@ -15,14 +15,17 @@ RandomTensor = torch.randn(1, 2) # Example audio tensor
|
|
15 |
print("Putting Tensor in device ...", device);
|
16 |
RandomTensor.to(device)
|
17 |
|
18 |
-
def sysinfo():
|
19 |
-
|
|
|
20 |
|
21 |
tocpu = tensorExample.cpu().squeeze().half().tolist()
|
22 |
|
23 |
return f"""
|
24 |
hostname: {platform.node()} {socket.gethostname()}
|
25 |
-
|
|
|
|
|
26 |
tensor: {tensorExample}
|
27 |
toCpu: {tocpu}
|
28 |
""";
|
@@ -35,7 +38,7 @@ def gpu():
|
|
35 |
|
36 |
def nogpu():
|
37 |
|
38 |
-
return sysinfo();
|
39 |
|
40 |
|
41 |
|
|
|
15 |
print("Putting Tensor in device ...", device);
|
16 |
RandomTensor.to(device)
|
17 |
|
18 |
+
def sysinfo(newdev = device):
|
19 |
+
currentDevice = RandomTensor.get_device();
|
20 |
+
tensorExample = RandomTensor.to(newdev)
|
21 |
|
22 |
tocpu = tensorExample.cpu().squeeze().half().tolist()
|
23 |
|
24 |
return f"""
|
25 |
hostname: {platform.node()} {socket.gethostname()}
|
26 |
+
dev cur: {currentDevice}
|
27 |
+
dev ini: {device}
|
28 |
+
dev new: {newdev}
|
29 |
tensor: {tensorExample}
|
30 |
toCpu: {tocpu}
|
31 |
""";
|
|
|
38 |
|
39 |
def nogpu():
|
40 |
|
41 |
+
return sysinfo("cpu");
|
42 |
|
43 |
|
44 |
|