[API Compatibility] Add alias paddle.random.get_rng_state#78472
[API Compatibility] Add alias paddle.random.get_rng_state#78472algorithm1832 wants to merge 2 commits intoPaddlePaddle:developfrom
paddle.random.get_rng_state#78472Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
/re-run all-failed |
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
python/paddle/random.py
Outdated
| @@ -33,3 +33,15 @@ def initial_seed() -> int: | |||
| >>> s = paddle.random.initial_seed() | |||
| """ | |||
| return core.default_cpu_generator().initial_seed() | |||
|
|
|||
|
|
|||
| def __getattr__(name): | |||
There was a problem hiding this comment.
这里可以直接导入到这个文件里来吗,是有循环导入的问题吗?因为只有一个API,影响较小,可考虑直接换个实现位置
|
尽量先用简单方式实现,绕不过再使用特殊技巧。 |
| def test_api_compatibility(self): | ||
| paddleObj = paddle.get_rng_state | ||
| aliasObj = paddle.random.get_rng_state | ||
| self.assertTrue(type(paddleObj) == type(aliasObj)) |
| @@ -71,6 +71,11 @@ def test_invalid_device_raises(self): | |||
| finally: | |||
| paddle.set_rng_state(original_state) | |||
|
|
|||
| def test_api_compatibility(self): | |||
| paddleObj = paddle.get_rng_state | |||
| @@ -19,6 +19,10 @@ | |||
| import paddle | |||
| from paddle.base import core | |||
|
|
|||
| # Note: paddle.random.get_rng_state is an alias for paddle.get_rng_state | |||
| # however due to circular import issues, implementation has been moved to paddle.random | |||
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (61.90%) 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 #78472 +/- ##
==========================================
Coverage ? 61.90%
==========================================
Files ? 2
Lines ? 21
Branches ? 0
==========================================
Hits ? 13
Misses ? 8
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

PR Category
User Experience
PR Types
Improvements
Description
paddle.random.get_rng_stateforpaddle.get_rng_stateUsed AI Studio
是否引起精度变化
否