to_tensor and pil_to_tensor inconsistency
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
to_tensor uses from_numpy which never copies and always returns a CPU tensor. But pil_to_tensor uses as_tensor, which would return a CUDA tensor if the default tensor type is changed by the user (e.g., https://github.com/pytorch/pytorch/issues/39088). I think a discussion on what the correct behavior is is needed, followed with a patch to make the two functions consistent.
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 comparing the to_tensor and pil_to_tensor entry points described in the issue, then review the linked PyTorch discussion about default tensor types. The work is complete when maintainers agree on the intended device and copy behavior and both functions consistently follow it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100