Skip to content

Conversation

@ooooo-create
Copy link
Contributor

@ooooo-create ooooo-create commented May 22, 2025

PR Category

Execute Infrastructure

PR Types

Improvements

Description

  • Torch 和 numpy 在 dtype 为 None,处理输入时,如果输入整数精度小于平台的默认整数时,会使用平台默认整数,cast 成 int64
  • PaddleApiTest 通过
    图片

@paddle-bot
Copy link

paddle-bot bot commented May 22, 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.

@paddle-bot paddle-bot bot added the contributor External developers label May 22, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label May 23, 2025
@ooooo-create ooooo-create marked this pull request as ready for review May 24, 2025 07:07
@ooooo-create
Copy link
Contributor Author

/re-run build

@ooooo-create
Copy link
Contributor Author

/re-run xpu

lshpku
lshpku previously approved these changes May 27, 2025
@luotao1
Copy link
Contributor

luotao1 commented May 29, 2025

API-benchmark一直没过

Comment on lines 4730 to 4739
converted_x_dtype = convert_dtype(x.dtype)
# use the default platform integer when integer dtype with a precision less than that of the default platform integer
if converted_x_dtype in {
"bool",
"uint16",
"int8",
"int16",
"int32",
"uint8",
}:
Copy link
Contributor

@lshpku lshpku May 29, 2025

Choose a reason for hiding this comment

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

这段代码涉及几次dict查找,比较耗时,过不了API性能监控(这个CI查得很严,python性能也要管),建议你可以在文件的适当地方定义一个纯DataType的set,像这样:

_supported_int_like_types = {
    DataType.BOOL,
    DataType.INT8,
    DataType.INT16,
    DataType.INT32,
    DataType.INT64,
    DataType.UINT8
}

然后在这里直接判断:

if x.dtype in _supported_int_like_types:
    x = cast(x, "int64")

当然能不能过CI还要你自己试一下

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!我试一下~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这样改了发现还是不能过耶,其实我们也可以通过手动设置 dtype 来达到 paddle 和 torch api 之间的切换,这样看起来也不算是精度问题吧,属于 api 设计的考量?目前可能去 paddleAPITest 仓库进行修改更加合适~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

提交了 PaddleAPITest 的修改 pr : PFCCLab/PaddleAPITest#212

@codecov-commenter
Copy link

codecov-commenter commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@d637d5b). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #72897   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         8           
  Branches           ?         0           
===========================================
  Hits               ?         8           
  Misses             ?         0           
  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.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jun 9, 2025

Sorry to inform you that 7ed04a4's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jun 24, 2025

Sorry to inform you that 9ade7fb's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants