Skip to content

Allow for arbitrary sequences in torchvision/transforms/functional #5398

Open
@Parskatt

Description

@Parskatt

🚀 The feature

Replace all checks for (list,tuple) in functional with Iterable.

Motivation, pitch

There are about 8 checks in functional right now which requires the argument to be either list or tuple, e.g.
https://github.com/pytorch/vision/blob/main/torchvision/transforms/functional.py#L1059
Instead of performing these checks, simply checking for Iterable allows to use e.g. numpy arrays.

In my usecase i generate parameters using numpy, and I don't want to convert them.

The documentation indicates that general sequences should work, so the current checks are counter-intuitive.

Alternatives

No response

Additional context

No response

cc @vfdev-5 @datumbox

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions