Skip to content

Commit 4aca751

Browse files
albanDpytorchmergebot
authored andcommitted
remove spurious warning in amp (pytorch#79203)
fix pytorch#72527 Pull Request resolved: pytorch#79203 Approved by: https://github.com/anjali411
1 parent 6813682 commit 4aca751

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch/amp/autocast_mode.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def __init__(self, device_type : str,
194194
else:
195195
raise RuntimeError('User specified autocast device_type must be \'cuda\' or \'cpu\'')
196196
self._cache_enabled = torch.is_autocast_cache_enabled()
197-
if torch.cuda.amp.common.amp_definitely_not_available() and self.device == 'cuda':
197+
if enabled and torch.cuda.amp.common.amp_definitely_not_available() and self.device == 'cuda':
198198
warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')
199199
enabled = False
200200
if dtype is not None:

0 commit comments

Comments
 (0)