6d27701311a5d0f013cf608dc5947e2fd0813882,hls4ml/model/hls_model.py,WeightVariable,update_precision,#WeightVariable#Any#,428
Before Change
match = re.search(".+<(.+?)>", self.type.precision)
if match is not None:
precision_bits = match.group(1).split(",")
decimal_bits = int(precision_bits[0]) - int(precision_bits[1])
decimal_spaces = int(np.floor(np.log10(2 ** decimal_bits - 1))) + 1
self.precision_fmt = "%.{}f".format(decimal_spaces)
else:
self.precision_fmt = "%f"
After Change
integer_bits = int(precision_bits[1])
fractional_bits = integer_bits - width_bits
lsb = 2 ** fractional_bits
if lsb < 1:
// Use str to represent the float with digits, get the length
// to right of decimal point
decimal_spaces = len(str(lsb).split(".")[1])
else:
decimal_spaces = len(str(2**integer_bits))
self.precision_fmt = "%.{}f".format(decimal_spaces)
else:
self.precision_fmt = "%f"
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: hls-fpga-machine-learning/hls4ml
Commit Name: 6d27701311a5d0f013cf608dc5947e2fd0813882
Time: 2020-05-04
Author: sioni.summers10@imperial.ac.uk
File Name: hls4ml/model/hls_model.py
Class Name: WeightVariable
Method Name: update_precision
Project Name: baldassarreFe/deep-koalarization
Commit Name: 3a25edce742db97d936ffb645185b520878d0c6d
Time: 2017-05-06
Author: baldassarre.fe@gmail.com
File Name: dataset/resize.py
Class Name: ImagenetResizer
Method Name: resize_img
Project Name: ncullen93/torchsample
Commit Name: a7d92f7020dfe8854430ef13ed2923b2606a6262
Time: 2017-05-11
Author: ncullen.th@dartmouth.edu
File Name: torchsample/utils.py
Class Name:
Method Name: th_random_choice