[Feature] Add functorch integration tests for TensorDictModule - Fixes #154#3697
Open
ParamThakkar123 wants to merge 1 commit intopytorch:mainfrom
Open
[Feature] Add functorch integration tests for TensorDictModule - Fixes #154#3697ParamThakkar123 wants to merge 1 commit intopytorch:mainfrom
ParamThakkar123 wants to merge 1 commit intopytorch:mainfrom
Conversation
Adds comprehensive test suite for functorch integration with TensorDictModule to address issue pytorch#154. Tests cover: - Functional params extraction from TDModule using TensorDict.from_module - vmap on TensorDictModule with functional params - Nested TDModules (ProbabilisticTensorDictModule) param handling - Param casting to different dtypes - TDSequence param handling with vmap - vmap with multiple input keys to module - VmapModule class usage - SafeSequential vmap - to_module context manager for functional params - Nested sequential vmap Fixes pytorch#154
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3697
Note: Links to docs will display an error until the docs builds have been completed.
|
Contributor
|
| Prefix | Label Applied | Example |
|---|---|---|
[BugFix] |
BugFix | [BugFix] Fix memory leak in collector |
[Feature] |
Feature | [Feature] Add new optimizer |
[Doc] or [Docs] |
Documentation | [Doc] Update installation guide |
[Refactor] |
Refactoring | [Refactor] Clean up module imports |
[CI] |
CI | [CI] Fix workflow permissions |
[Test] or [Tests] |
Tests | [Tests] Add unit tests for buffer |
[Environment] or [Environments] |
Environments | [Environments] Add Gymnasium support |
[Data] |
Data | [Data] Fix replay buffer sampling |
[Performance] or [Perf] |
Performance | [Performance] Optimize tensor ops |
[BC-Breaking] |
bc breaking | [BC-Breaking] Remove deprecated API |
[Deprecation] |
Deprecation | [Deprecation] Mark old function |
[Quality] |
Quality | [Quality] Fix typos and add codespell |
Note: Common variations like singular/plural are supported (e.g., [Doc] or [Docs]).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a comprehensive test suite for functorch integration with TensorDictModule to address issue #154.
Tests Added
test_tdmodule_functional_params- Tests extracting functional params from a TDModule usingTensorDict.from_moduletest_vmap_on_tdmodule_with_params- Tests vmap on TensorDictModule with functional params expanded across batch dimensiontest_nested_tdmodule_param_length- Tests nested TDModules (SafeProbabilisticTensorDictSequential) param extractiontest_nested_tdmodule_param_casting- Tests that params can be cast to different dtypes (e.g., float64)test_tdsequence_vmap_params- Tests TDSequence param handling with vmaptest_vmap_multiple_inputs- Tests vmap with multiple input keys to moduletest_vmap_module_class- Tests VmapModule class directlytest_tdsequence_vmap- Tests vmap on SafeSequentialtest_tdmodule_functional_to_module- Tests theto_modulecontext manager for functional paramstest_nested_sequential_vmap- Tests vmap on nested TensorDictSequential modulesAll tests cover the functionality requested in the issue.
Fixes #154