ARTIST-Association / ARTIST-Association/ARTIST

Recursive copy and detach method for `Scenario`

Open
#212 0 comments 0 reactions 0 assignees View on GitHub
Urgency: Low
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.