Commit 3d8340d
committed
Fix torch.accelerator AttributeError in tensorqs_tutorial
The tutorial was using torch.accelerator.is_available() and
torch.accelerator.current_accelerator() which causes an AttributeError
in PyTorch versions that don't have the accelerator API.
Changed to use the more widely compatible torch.cuda.is_available()
and tensor.to('cuda') pattern that works across all PyTorch versions.
Fixes issue where users get: module 'torch' has no attribute 'accelerator'1 parent 4fa1fa8 commit 3d8340d
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
| 114 | + | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
0 commit comments