Cadene / Cadene/pretrained-models.pytorch

problem:RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size: : [20]

Open
#151 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
9.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

(1)when i run the architecture squeezenet1_0 and squeezenet1_1 ,I met the problem above.
(2)then I print the shape of output and target as below:
output.shape torch.Size([20, 1000, 1, 1])
target.shape torch.Size([20])
obviously, it' s the reason that the shape is not matched.
(3)so i add the code:
output = model(input)
output =output.reshape(-1,1000)
and it worked
(4)but there maybe remains some better solution,such as modify the code of squeezenet1_0 and squeezenet1_1(ps: because other architetures don't have the problems above)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported error with squeezenet1_0 and squeezenet1_1, then inspect their output shapes alongside the target shape shown in the issue. Compare these architectures with the others that do not fail; done means the reported training path accepts the model output without requiring an ad hoc reshape.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.