Skip to content

[Deprecation] Deprecate TensorDictModule.device - #1770

Merged
vmoens merged 1 commit into
pytorch:mainfrom
vmoens:deprecate-tdmodule-device
Aug 21, 2026
Merged

[Deprecation] Deprecate TensorDictModule.device#1770
vmoens merged 1 commit into
pytorch:mainfrom
vmoens:deprecate-tdmodule-device

Conversation

@vmoens

@vmoens vmoens commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Description

Deprecates TensorDictModule.device in TensorDict 0.15 and schedules its removal for TensorDict 0.17. A module may contain parameters and buffers on multiple devices, so a single inferred device is not a valid module-level property.

The property retains its existing behavior during the deprecation window and emits a DeprecationWarning with the removal version. The generated API documentation also marks it as deprecated. No replacement scalar-device API is introduced.

This change was developed as a direct follow-up to #1767 and has now been rebased onto main after that PR merged.

Test plan

  • python -m pytest test/nn/test_nn.py -k "repr or device_deprecation" -q
  • python -m pytest test/nn -q (610 passed, 1 skipped)
  • Black, critical Ruff checks, and git diff --check

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 21, 2026
@github-actions github-actions Bot added Deprecation Announces or enacts a deprecation Test nn and removed Deprecation Announces or enacts a deprecation labels Aug 21, 2026
@vmoens
vmoens marked this pull request as ready for review August 21, 2026 13:40
@vmoens
vmoens merged commit a1a061e into pytorch:main Aug 21, 2026
62 of 65 checks passed
@vmoens
vmoens deleted the deprecate-tdmodule-device branch August 21, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. nn Test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant