Allow for arbitrary sequences in torchvision/transforms/functional
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
🚀 The feature
Replace all checks for (list,tuple) in functional with Iterable.
Motivation, pitch
There are about 8 checks in functional right now which requires the argument to be either list or tuple, e.g.
https://github.com/pytorch/vision/blob/main/torchvision/transforms/functional.py#L1059
Instead of performing these checks, simply checking for Iterable allows to use e.g. numpy arrays.
In my usecase i generate parameters using numpy, and I don't want to convert them.
The documentation indicates that general sequences should work, so the current checks are counter-intuitive.
Alternatives
No response
Additional context
No response
cc @vfdev-5 @datumbox
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.
Research direction
Start in torchvision/transforms/functional.py at the check near line 1059, then locate the other checks that only accept lists or tuples. Replace the restrictive checks with Iterable-based handling so numpy arrays and other general sequences are accepted, and verify the existing functional transform tests cover the changed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100