Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
val = it[0]
if not (val == 0 and extra_nzero_cnt < 1):
if val == 0:
extra_nzero_cnt -= 1
if it.multi_index[0] > max_idx:
max_idx = it.multi_index[0]
if it.multi_index[1] > max_idx:
max_idx = it.multi_index[1]
weights.append([it.multi_index[1], it.multi_index[0], val])
it.iternext()
weights.sort()
index_precision = 32
if max_idx > 0:
index_precision = int(np.log2(max_idx) + 1)
self.type = CompressedType(type_name, precision, 'ap_uint<{}>'.format(index_precision), **kwargs)
self.data = weights
def __init__(self, name, precision, index_precision, **kwargs):
super(CompressedType, self).__init__('compressed_type{index}', precision, **kwargs)
self.index_precision = index_precision