ARTIST-Association / ARTIST-Association/ARTIST
Recursive copy and detach method for `Scenario`
- Dominant language
- Python
- Stars
- 12
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
I would like to have a way to make copies of `Scenario` instances without duplicating the entire autograd computation graph.
Currently, copying a `Scenario` also retains references to the underlying computation graph of all contained tensors, which can lead to unnecessary memory usage (and unintended gradient flows in copies). To avoid this, all torch.Tensor objects contained anywhere within the nested `Scenario` structure should be detached from the autograd graph during the copy process.
Contributor guide
Research direction
Locate the Scenario implementation and its existing copy behavior, then inspect how nested values and torch.Tensor objects are traversed. Add coverage for nested scenarios and verify that copied tensors are detached while the original structure remains unchanged and no unintended gradient flow is retained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100