[Feature Request] cloning inconsistencies
Open
@vmoens is already working on this.
Since Aug 7, 2022.
enhancement
- Dominant language
- Python
- Stars
- 3.6k
- Forks
- 484
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 207
Description
Motivation
clone() should either return an object of the same type (e.g. SavedTensorDict.clone() returns a SavedTensorDict instance) or a generic type (e.g. MemmapTensor.clone() returns a torch.Tensor instance.)
Pros of same-type
- It makes sense that cloning an object returns a copy of this object (not another type)
- In the case of multi-task, we use the feature that a
LazyStackedTensorDictcontains tensordicts whose keys can be hidden. However, if cloning returns a regularTensorDict, those keys will be lost.
### Pros of generic type
- For users that do not have a very deep understanding of the repo's primitives, it can make more sense for clone to return the generic type. Also, if cloning a stack of tensordicts returns another stack of other tensordicts, it is hard to see what the advantage and what the usage could be.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.