Files
hehe7758511 5086a6c4f2 [Docs] Add support information for torch.utils.checkpoint.get_device_states
Co-authored-by: hehe7758511<2941625023@qq.com>



# message auto-generated for no-merge-commit merge:
!44713 merge docs-get-device-states-master-v2 into master

[Docs] Add support information for torch.utils.checkpoint.get_device_states

Created-by: hehe7758511
Commit-by: hehe7758511
Merged-by: ascend-robot
Description: ## 修改内容

在以下 PyTorch 版本的 `torch.utils.checkpoint` 支持资料中补充
`torch.utils.checkpoint.get_device_states`:

- PyTorch 2.7.1
- PyTorch 2.9.0
- PyTorch 2.11.0
- PyTorch 2.10.0
- PyTorch 2.12.0
- PyTorch 2.13.0
- PyTorch 2.14.0

该 API 在 Atlas A2、Atlas A3 和 Ascend 950DT 上标记为支持。

## 社区用例情况

PyTorch 社区已有 checkpoint RNG 保存和恢复用例。

TorchNPU 的
`test/test_utils.py::TestCheckpoint::test_checkpoint_rng_cuda`
已经使用 NPU 张量、NPU Dropout 和 `torch.npu.get_rng_state()` 完成适配,
能够通过 checkpoint 调用链覆盖
`torch.utils.checkpoint.get_device_states` 的核心功能。

现有用例覆盖充分,因此无需新增测试用例。

## NPU 验证

验证环境:

- Ubuntu 22.04
- Python 3.11
- PyTorch 2.10.0
- torch-npu 2.10.0
- Ascend 910B3

验证结果:

- NPU 张量设备编号采集:PASS
- NPU RNG 状态采集:PASS
- 嵌套参数:PASS
- 空参数:PASS
- `test_checkpoint_rng_cuda`:PASS

## 其他检查

- API 实现无需修改。
- 未发现设备硬编码问题。
- `git diff --check` 通过。
- 本 PR 仅修改 API 支持资料。

关联任务:
https://gitcode.com/Ascend/pytorch-ecosystem/issues/149

支持说明 Issue:
https://gitcode.com/Ascend/pytorch/issues/4089

See merge request: Ascend/pytorch!44713
2026-10-10 22:51:58 +08:00
..