lsq-net icon indicating copy to clipboard operation
lsq-net copied to clipboard

Error: Divided by 0.

Open woriazzc opened this issue 3 years ago • 3 comments

Thanks for your the implementation!

In LsqQuan. https://github.com/zhutmost/lsq-net/blob/2c24a96be06d044fa4c7d651727f4574b8d88c86/quan/quantizer/lsq.py#L54 If s_scale contains 0, there will be Divided by 0 Error, and the training loss will become nan. Maybe eps should be used.

woriazzc avatar Feb 18 '22 09:02 woriazzc

Looks that it is very rarely seen. s_scale is a floating pointed number, it generally does not become 0 during training.

I will try to add an eps, when I have spare time. (it need some experiments)

zhutmost avatar Feb 18 '22 10:02 zhutmost

Looks that it is very rarely seen. s_scale is a floating pointed number, it generally does not become 0 during training. I will try to add an eps, when I have spare time. (it need some experiments)

Not rarely.

lippman1125 avatar May 29 '22 08:05 lippman1125

Not rarely.

flymmmfly avatar Nov 26 '23 04:11 flymmmfly