warp-ctc icon indicating copy to clipboard operation
warp-ctc copied to clipboard

Why gradient does not scale linearly with CTCloss in pytorch binding?

Open lifelongeek opened this issue 7 years ago • 2 comments

I am pytorch user, and I am curious this issue is generally occurs in every platform of CTC. Originally, this issue is posted in https://github.com/SeanNaren/deepspeech.pytorch/issues/250.

I am trying to use CTCLoss with another loss, and want coefficients of CTCLoss smaller. But when I tried different

This is the extreme cases for small CTCLoss. (CTCLoss coefficient = 0)

criterion = CTCLoss() loss = 0*criterion(out, targets, sizes, target_sizes) model.zero_grad() loss.backward() optimizer.step()

for param in model.parameters(): if param.grad is not None: grad_norm += param.grad.norm().data[0] In above example, loss is always 0. However, fairly large gradient value still exists even CTCLoss coefficient is 0.

Can anyone explain why gradient does not scale linearly with CTCLoss?

lifelongeek avatar Feb 14 '18 07:02 lifelongeek

@gmkim90

Hi, I found this problem too. Did you solve it?

Thank you very much.

weedwind avatar Jul 12 '18 18:07 weedwind

No. still does not understand the reason.

lifelongeek avatar Jul 12 '18 23:07 lifelongeek