Hi, I noticed two mistakes in this code after fast browsing the paper.
First, while may not influence in some circumstances:
weights_t = torch.where( abs(weights_t) > self.cw + self.dw,
									torch.sign(weights_t), weights_t)
weights_t = torch.where( (abs(weights_t) >= self.cw - self.dw)&(abs(weights_t) <= self.cw + self.dw),
									(aw*abs(weights_t) + bw)**self.gamma  * weights_t.sign() , weights_t)

The condition are based on the modified weights instead of the original weight, which may produce incorrect results.
Second, you are initializing
self.dw = nn.Parameter(torch.randn(1),requires_grad=True)

I think that dw should be the quantization interval and should be positive.
If it’s negative,
(abs(weights_t) >= self.cw - self.dw)&(abs(weights_t) <= self.cw + self.dw)

is never satisfied and your parameters never get trained, right?
You initialize it as random gaussian so it can be negative 50%.