Skip to content

Conversation

@algorithm1832
Copy link
Contributor

@algorithm1832 algorithm1832 commented Jan 21, 2026

PR Category

User Experience

PR Types

Improvements

Description

  • Add import logic for paddle.utils.data to avoid circular import
  • Add error test
  • Add alias for Sampler, SequenceSampler, Subset, get_worker_info, random_split, default_collate_fn. Some imports are not used so noqa is added
  • Add corresponding tests

See Also: #77391
See Also: #77275

Used AI Studio


目前支持如下方式导入(和torch对齐):

import paddle.utils.data
paddle.utils.data.Dataset
from paddle.utils.data import Dataset
Dataset
import paddle
paddle.utils.data.Dataset
import paddle.utils
paddle.utils.data.DatasetDataset

@paddle-bot
Copy link

paddle-bot bot commented Jan 21, 2026

你的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 Jan 21, 2026
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.

迁移更多API到paddle.utils.data里面来,同时在test/legacy_test/test_paddle_io_alias.py添加更多测试,这个测试改个名字吧。改成test_paddle_utils_data.py,另外覆盖率没过。

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@d5a87b6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/utils/__init__.py 42.85% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (42.85%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

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

@algorithm1832 algorithm1832 changed the title [API Compatibility] Add lazy import for paddle.utils.data [API Compatibility] Add lazy import and other aliases for paddle.utils.data Jan 22, 2026
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.

  1. 覆盖率没过
  2. 在PaConvert上测试下这些API是否已实现『用法完全一致』,目前解决了调用路径问题。如果还有其他兼容问题,需继续修改原API。最终目标还是通过PaConvert测试

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants