Implement tensor handling for ToTensor()
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
The ToTensor() function of torchvision.transforms must be able to handle torch Tensors. If it gets a tensor, it must return the same tensor without modification
Motivation, pitch
The function ToTensor can take a NumPy array as input. But if a torch tensor is passed to it, the function raises an error. It will be better if the function can take PyTorch tensors too without raising error.
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 by locating ToTensor() in torchvision.transforms and reviewing the existing transform tests. Confirm the desired behavior for torch tensor input: it returns the same tensor unchanged, while the existing NumPy-array behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100