Skip to content

Setting a 1D tensor to ToImage() gets an empty error message #9025

@hyperkai

Description

@hyperkai

🐛 Describe the bug

Setting a 1D tensor to ToImage() gets the empty error message as shown below:

from torchvision.datasets import OxfordIIITPet
import torch

my_data = OxfordIIITPet(
    root="data"
)

ti = ToImage()

ti(torch.tensor([0])) # Error

ValueError:

So, it should be something like below:

ValueError: the tensor must be 2D or more D tensor

Versions

import torchvision

torchvision.__version__ # '0.20.1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions