pytorch / pytorch/vision

`NEAREST_EXACT` and `BICUBIC` work against the doc of `TrivialAugmentWide()`

Open
#9,072 2 comments 0 reactions 1 assignee View on GitHub

@AntoineSimoulin is already working on this.

Since May 21, 2025.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🐛 Describe the bug

The doc of TrivialAugmentWide() says that only NEAREST and BILINEAR are supported:

Parameters:
...

  • interpolation (InterpolationMode, optional) – ... If input is Tensor, only InterpolationMode.NEAREST, InterpolationMode.BILINEAR are supported.

But NEAREST_EXACT and BICUBIC work against the doc as shown below:

from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import TrivialAugmentWide, PILToTensor

origin_data = OxfordIIITPet(
    root="data"
)

def show_tawimagetensor(im, ip=None):
    taw = TrivialAugmentWide(interpolation=ip)
    ptt = PILToTensor()
    print(ptt(taw(im))[0][200])

show_tawimagetensor(im=origin_data[0][0], ip=InterpolationMode.NEAREST_EXACT)
# tensor([ 96,  99,  97, 101, 106, 114, 115, 116, 120, 117,
#         110, 108, 107, 101, 100,  96,  90,  87,  80,  77,
#          65,  67,  62,  55,  49, ..., 169,  170, 177], dtype=torch.uint8)

show_tawimagetensor(im=origin_data[0][0], ip=InterpolationMode.BICUBIC)
# tensor([ 18,  19,  19,  18,  17,  19,  20,  20,  20,  20,
#          20,  21,  16,  17,  17,  17,  19,  17,  17,  18,
#          19,  14,  17,  19,  18, ...,  19,  15,  15], dtype=torch.uint8)
Versions
import torchvision

torchvision.__version__ # '0.20.1'

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.