Skip to content

Conversation

@fxyfxy777
Copy link
Contributor

@fxyfxy777 fxyfxy777 commented Jan 21, 2026

PR Category

User Experience

PR Types

Bug fixes

Description

对齐torch.device 和paddle.device上的逻辑关系

@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.

@zhwesky2010 zhwesky2010 changed the title [User Experience] Fix device [API Compatibility] Fix device Jan 21, 2026
else:
dev_type = t
dev_index = None
dev_index = current_device() if t != "cpu" else None
Copy link
Contributor

@zhwesky2010 zhwesky2010 Jan 21, 2026

Choose a reason for hiding this comment

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

目前这种index为None的设计其实没问题,某些情况下能对得更齐,torch也是可以处理None的:

infoflow 2026-01-21 19-36-07

看起来是打印这里的问题
infoflow 2026-01-21 19-45-00

infoflow 2026-01-21 19-47-25

从而导致了CUDA为0下打印不对,所以GPU0上的Tensor.device就对不齐了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update

@fxyfxy777
Copy link
Contributor Author

/re-run all-failed

1 similar comment
@fxyfxy777
Copy link
Contributor Author

/re-run all-failed

@fxyfxy777
Copy link
Contributor Author

/re-run all-failed

@fxyfxy777
Copy link
Contributor Author

/re-run all-failed

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@22adb1a). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #77467   +/-   ##
===========================================
  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.

@zhwesky2010 zhwesky2010 merged commit c338002 into PaddlePaddle:develop Jan 22, 2026
65 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants