zhanghang1989 / zhanghang1989/PyTorch-Encoding

Error about output = module(*(input + target), **kwargs)

Open
#151 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
448
PR merge metrics
No merged PRs in 30d

Description

When I use DataParallelModel and DataParallelCriterion, Wrong Occur, like
`
Traceback (most recent call last):
File "train_SyncBN.py", line 151, in
loss = criterion(outputs, labels)
File "/home/phd-1/.conda/envs/pytorch-0.41/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(input, **kwargs)
File "/home/phd-1/.conda/envs/pytorch-0.41/lib/python3.6/site-packages/encoding/parallel.py", line 134, in forward
outputs = _criterion_parallel_apply(replicas, inputs, targets, kwargs)
File "/home/phd-1/.conda/envs/pytorch-0.41/lib/python3.6/site-packages/encoding/parallel.py", line 188, in _criterion_parallel_apply
raise output
File "/home/phd-1/.conda/envs/pytorch-0.41/lib/python3.6/site-packages/encoding/parallel.py", line 163, in _worker
output = module(
(input + target), **kwargs)
TypeError: add() received an invalid combination of arguments - got (tuple), but expected one of:

  • (Tensor other, Number alpha)
  • (Number other, Number alpha)
    `
    my net output just a tensor x, not tuple, how to slove it ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from train_SyncBN.py line 151, then inspect encoding/parallel.py around lines 134, 163, and 188 to trace how outputs and targets are passed to the criterion. Confirm the expected input shape for DataParallelCriterion and document or validate the behavior for a tensor output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.