Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support returning dictionaries in DataParallel#6113

Merged
apaszke merged 3 commits into
pytorch:masterfrom
mseitzer:gather-dict-support
Apr 2, 2018
Merged

Support returning dictionaries in DataParallel#6113
apaszke merged 3 commits into
pytorch:masterfrom
mseitzer:gather-dict-support

Conversation

@mseitzer
Copy link
Copy Markdown
Contributor

This change allows to use modules which return dictionaries with DataParallel.
Fixes #2992.

This is my first PR, please tell me if violated any standards.

@ssnl
Copy link
Copy Markdown
Collaborator

ssnl commented Mar 29, 2018

@pytorchbot test this please

Comment thread torch/nn/parallel/scatter_gather.py Outdated
if out is None:
return None
if isinstance(out, dict):
values = (item.values() for item in outputs)

This comment was marked as off-topic.

This comment was marked as off-topic.

@ssnl
Copy link
Copy Markdown
Collaborator

ssnl commented Mar 30, 2018

The new commit LGTM. Maybe @apaszke wants to take an extra look

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Mar 30, 2018

@pytorchbot test this please

return None
if isinstance(out, dict):
return type(out)(((k, gather_map([d[k] for d in outputs]))
for k in out))

This comment was marked as off-topic.

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Apr 2, 2018

@pytorchbot test this please

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.

DataParallel Gather works only with iterable outputs

4 participants