MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / quantize

Method quantize

ioblocks.py:216–220  ·  view source on GitHub ↗

Quantizes z, returns quantized zhat, same shape as z.

(self, z)

Source from the content-addressed store, hash-verified

214 return (z + shift).tanh() * half_l - offset
215
216 def quantize(self, z):
217 """ Quantizes z, returns quantized zhat, same shape as z. """
218 quantized = round_ste(self.bound(z))
219 half_width = self._levels // 2 # Renormalize to [-1, 1].
220 return quantized / half_width
221
222 def _scale_and_shift(self, zhat_normalized):
223 half_width = self._levels // 2

Callers 1

forwardMethod · 0.95

Calls 2

boundMethod · 0.95
round_steFunction · 0.85

Tested by

no test coverage detected