sign = np.where(y < 0, np.zeros_like(y), np.ones_like(y))
// Take the logarithm, since this is what we will write to the header
// for the optimized product using shifts
y = (tf.math.log(tf.math.abs(y)) / tf.math.log(2.)).numpy().astype("int")
return np.stack((sign, y), axis=-1)
def get_type(quantizer_config):
width = quantizer_config["config"]["bits"]
After Change
"""
x = tf.convert_to_tensor(data)
y = self.quantizer_fn(x)
if hasattr(y, "numpy"):
y = y.numpy()
return y
def get_type(quantizer_config):
width = quantizer_config["config"]["bits"]