Skip to content

Commit e430d55

Browse files
committed
Updated deprecated use_gpu profiler argument to use_device
1 parent 05c08f2 commit e430d55

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

beginner_source/introyt/autogradyt_tutorial.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,14 @@ def add_tensors2(x, y):
473473
#
474474

475475
device = torch.device('cpu')
476-
run_on_gpu = False
477476
if torch.cuda.is_available():
478477
device = torch.device('cuda')
479-
run_on_gpu = True
480-
478+
481479
x = torch.randn(2, 3, requires_grad=True)
482480
y = torch.rand(2, 3, requires_grad=True)
483481
z = torch.ones(2, 3, requires_grad=True)
484482

485-
with torch.autograd.profiler.profile(use_cuda=run_on_gpu) as prf:
483+
with torch.autograd.profiler.profile(use_device=device.type) as prf:
486484
for _ in range(1000):
487485
z = (z / x) * y
488486

0 commit comments

Comments
 (0)