Skip to content

add a vision_collate function that honours prototype features #6680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Oct 3, 2022

Addresses #6433 (comment). I've intentionally left out the collation function, since we just use

def collate_fn(batch):
return tuple(zip(*batch))

which is completely separated from default_collate. We might provide it publicly later on as well.

@pmeier pmeier requested review from datumbox and ejguan October 3, 2022 09:57
@pmeier pmeier changed the title Vision collate add a vision_collate function that honours prototype features Oct 3, 2022

vision_collate_fn_map = {
(Image, Mask, Label, OneHotLabel): new_like_collate_fn,
type(None): no_collate_fn,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need this for #5233.

@@ -0,0 +1,29 @@
from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Type, Union
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've put this into features for now, put when everything is rolled out it should probably be in datasets.

Copy link
Contributor

@ejguan ejguan left a comment

Choose a reason for hiding this comment

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

LGTM in terms of vision_collate

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

Ideally we should avoid adding collate methods directly in TorchVision. One option is to keep it on the references. That's something that we plan to discuss with @pmeier once he is back from PTO. The discussion can go either way so, everything is on the table.

I'm going to mark the PR with "request changes" to avoid accidental merges (since 1 approval = merge). After we sync with Philip, we can unblock this. 😃

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