Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions python/paddle/amp/auto_cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,19 +524,21 @@ def amp_guard(
# For xpu:
if tracer._expected_place.is_xpu_place():
if (dtype == 'float16') and not _is_xpu_float16_supported():
xpu_verion = core.get_xpu_device_version(
xpu_version = core.get_xpu_device_version(
_current_expected_place().get_device_id()
)
warnings.warn(
'XPU%d does not support float16 amp.' % xpu_verion
'%s does not support float16 amp.'
% core.XPUVersion(xpu_version)
)
enable = False
elif (dtype == 'bfloat16') and not _is_xpu_bfloat16_supported():
xpu_verion = core.get_xpu_device_version(
xpu_version = core.get_xpu_device_version(
_current_expected_place().get_device_id()
)
warnings.warn(
'XPU%d does not support bfloat16 amp.' % xpu_verion
'%s does not support bfloat16 amp.'
% core.XPUVersion(xpu_version)
)
enable = False
# For custom device:
Expand Down