tutorials
tutorials copied to clipboard
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'
Fixes #3629
Description
Checklist
- [ ] The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
- [ ] Only one issue is addressed in this pull request
- [ ] Labels from the issue that this PR is fixing are added to this pull request
- [ ] No unnecessary issues are included into this pull request.