pytorch / pytorch/vision

Add uint8 support for interpolate and grid-sample in PyTorch

Open
#2,289 4 comments 6 reactions 1 assignee View on GitHub

@vfdev-5 is already working on this.

Since Dec 20, 2020.

help wanted high priority module: transforms
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🚀 Feature

With the addition of torch tensor support for the transforms (following https://github.com/pytorch/vision/issues/1375), there are two operators that will require extra attention in order for them to be as efficient as the PIL implementations.

Indeed, while we can implement resize via torch.nn.functional.interpolate and rotate via torch.nn.functional.grid_sample, those operators for now only support floating-point types, so for now we need to perform a .float() -> interpolate() -> byte() in order to maintain compatibility, which is wasteful.

It would be great if they could be extended to support uint8 (and maybe other integer types) as well.

A first PR adding support for uint8 to nearest mode interpolate has been sent in https://github.com/pytorch/pytorch/pull/35029

Something to keep in mind: the interpolate function is under optimization in https://github.com/pytorch/pytorch/pull/34864, so this should be kept in mind to avoid conflicts.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.