Skip to content

Conversation

@LittleHeroZZZX
Copy link
Contributor

@LittleHeroZZZX LittleHeroZZZX commented Aug 6, 2025

PR Category

User Experience

PR Types

Improvements

Description

新增 paddle.is_autocast_enabled 、get_autocast_dtype get_autocast_gpu_dtype API。其中,get_autocast_gpu_dtype是get_autocast_dtype的别名。

三个 API 均接收一个可选参数device_dtype,仅出于兼容 torch 对应 API 而设置。Paddle 中所有设备共享同一套 AMP 配置,device_dtype 不影响返回结果。

CN doc: PaddlePaddle/docs#7375

@paddle-bot
Copy link

paddle-bot bot commented Aug 6, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@1987f7c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/amp/auto_cast.py 88.23% 2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## develop #74441 +/- ## ========================================== Coverage ? 90.00% ========================================== Files ? 3 Lines ? 20 Branches ? 0 ========================================== Hits ? 18 Misses ? 2 Partials ? 0 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Comment on lines 32 to 33
if TYPE_CHECKING:
from paddle._typing import PlaceLike
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if TYPE_CHECKING 不要放在 import 中间,放在其他 import 之后

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@LittleHeroZZZX
Copy link
Contributor Author

/re-run all-failed

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LittleHeroZZZX
Copy link
Contributor Author

/re-run all-failed

@zhwesky2010 zhwesky2010 merged commit 4ad8416 into PaddlePaddle:develop Aug 12, 2025
110 of 117 checks passed
maxiaolong001 pushed a commit to maxiaolong001/Paddle that referenced this pull request Aug 12, 2025
…Paddle#74441) * Add get_autocast_dtype. get_autocast_gpu_dtype and is_autocast_enable APIs * refine docs * set default dtype to fp16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment