hiascend commited on
Commit
5438a6b
·
verified ·
1 Parent(s): e65f9d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -13,11 +13,15 @@ print('one device: ' + str(one.device))
13
  two = torch.matmul(one, one).cuda()
14
  print('two device: ' + str(two.device))
15
 
 
 
 
16
  @spaces.GPU
17
  def greet(n):
18
  print('zero device: ' + str(zero.device))
19
  print('one device: ' + str(one.device))
20
  print('two device: ' + str(two.device))
 
21
  return f"Hello {zero + n} Tensor"
22
 
23
  gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()
 
13
  two = torch.matmul(one, one).cuda()
14
  print('two device: ' + str(two.device))
15
 
16
+ tpu_res = torch.ones(2, 2, device='tpu')
17
+ print('tpu_res device: ' + str(tpu_res.device))
18
+
19
  @spaces.GPU
20
  def greet(n):
21
  print('zero device: ' + str(zero.device))
22
  print('one device: ' + str(one.device))
23
  print('two device: ' + str(two.device))
24
+ print('tpu_res device: ' + str(tpu_res.device))
25
  return f"Hello {zero + n} Tensor"
26
 
27
  gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()