Skip to content

Conversation

wangg12
Copy link
Contributor

@wangg12 wangg12 commented Sep 28, 2023

For example, when we pass a size arg in a config created by omegaconf, only allowing list, tuple will raise an error.

cc @vfdev-5

For example, when we pass a `size` arg in a config created by omegaconf, only allowing `list, tuple` will raise an error.
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 28, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7999

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 11 Unrelated Failures

As of commit 0fd300c with merge base a8c4875 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wangg12 , LGTM (I'll self-commit my suggestion below and wait for the CI before merging)

Technically we should probably be using Sequence from collections.abc instead of from typing (EDIT: because most of the typing stuff is deprecated from 3.9), but maybe this is better addressed in a more general PR. @pmeier any opinion?

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we should probably be using Sequence from collections.abc instead of from typing, but maybe this is better addressed in a more general PR.

typing.Sequence is actually an alias for collections.abc.Sequence. Meaning, we can do it for clarity, but there is no functional difference.


Should we also fix the error message below to reflect that this supports arbitrary sequences now?

else:
raise ValueError(
f"size can either be an integer or a list or tuple of one or two integers, " f"but got {size} instead."
)

@NicolasHug
Copy link
Member

Linux unittests and linters are happy, merging. Thanks @wangg12 !

@NicolasHug NicolasHug merged commit f33e387 into pytorch:main Sep 28, 2023
facebook-github-bot pushed a commit that referenced this pull request Oct 30, 2023
Reviewed By: vmoens

Differential Revision: D50789091

fbshipit-source-id: e9d6cebe293c2c8052b2ae0f731b0a5888309829

Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants