8c4ca59b578a5e4bc7ef82c69722247307280160,hls4ml/model/optimizer/passes/qkeras.py,QKerasPO2Quantizer,__call__,#QKerasPO2Quantizer#Any#,15
Before Change
x = tf.convert_to_tensor(data)
y = self.quantizer_fn(x)
// Use an XnorBinary-like representation for the sign
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)
class OutputRoundingSaturationMode(OptimizerPass):
"""
Set the Rounding and Saturation mode of the output (and accumulator, if applicable)
After Change
"""
x = tf.convert_to_tensor(data)
y = self.quantizer_fn(x)
if hasattr(y, "numpy"):
y = y.numpy()
return y
class OutputRoundingSaturationMode(OptimizerPass):
"""
Set the Rounding and Saturation mode of the output (and accumulator, if applicable)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances Project Name: hls-fpga-machine-learning/hls4ml
Commit Name: 8c4ca59b578a5e4bc7ef82c69722247307280160
Time: 2020-11-18
Author: sioni.summers10@imperial.ac.uk
File Name: hls4ml/model/optimizer/passes/qkeras.py
Class Name: QKerasPO2Quantizer
Method Name: __call__
Project Name: PIQuIL/QuCumber
Commit Name: db073909d05ae6f91b7abd8d6251bfa247349447
Time: 2019-12-31
Author: emerali@users.noreply.github.com
File Name: qucumber/utils/cplx.py
Class Name:
Method Name: conjugate
Project Name: hls-fpga-machine-learning/hls4ml
Commit Name: 8c4ca59b578a5e4bc7ef82c69722247307280160
Time: 2020-11-18
Author: sioni.summers10@imperial.ac.uk
File Name: hls4ml/converters/keras/qkeras.py
Class Name: QKerasPO2Quantizer
Method Name: __call__