MCPcopy
hub / github.com/OpenPPL/ppq / forward

Method forward

ppq/quantization/optim/legacy.py:58–64  ·  view source on GitHub ↗
(self, r: torch.Tensor, iter: int)

Source from the content-addressed store, hash-verified

56 return ((self.zeta - self.gamma) * torch.sigmoid(r) + self.gamma).clamp(0, 1)
57
58 def forward(self, r: torch.Tensor, iter: int) -> torch.Tensor:
59 if iter < self.max_iter * self.warm_ratio:
60 round_loss = 0
61 else:
62 self.beta = self.temp_anneal(iter)
63 round_loss = self.alpha * (1 - torch.pow((self.rectified_sigmoid(r) - 0.5).abs() * 2, self.beta)).sum()
64 return round_loss
65
66
67class AdaRoundDelegator(TorchQuantizeDelegator):

Callers 10

collect_training_dataMethod · 0.45
calibrateMethod · 0.45
regularization_lossMethod · 0.45
collect_activationsMethod · 0.45
calibrateMethod · 0.45
test_ssd_lossMethod · 0.45
checkMethod · 0.45
collectMethod · 0.45

Calls 1

rectified_sigmoidMethod · 0.95

Tested by 1

test_ssd_lossMethod · 0.36