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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

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: tensorflow/ranking
Commit Name: d3f1a5ad4507e88b016e0a829f4ba142294c16e6
Time: 2019-11-12
Author: xuanhui@google.com
File Name: tensorflow_ranking/python/losses.py
Class Name: _SoftmaxLoss
Method Name: _precompute


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__