torch / nn

Other
1.34k stars 967 forks source link

SpatialLogSoftMax outputs zeros when batch size is 1 #1089

Open rracinskij opened 7 years ago

rracinskij commented 7 years ago

Hi,

just noticed that nn.SpatialLogSoftMax() outputs zeros if the batch size is 1.

E.g. the readme example

ii=torch.randn(4,8,16,16)  -- batchSize x features x height x width
m=nn.SpatialLogSoftMax()
oo = m:forward(ii)

works properly, but torch.randn(4,8,16,16) will output zeros. Is it a bug or a feature?

buttomnutstoast commented 7 years ago

I have the same problem, which leads the output error of nn.ClassNLLCriterion to inf