Skip to content

Commit

Permalink
fix sign inference for dense layer
Browse files Browse the repository at this point in the history
  • Loading branch information
calad0i committed Jan 13, 2024
1 parent d42879a commit 8a6b1b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/HGQ/proxy/precision_derivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def _(layer: keras.layers.Dense | Conv):
assert len(kifs) == 1, f'Dense layer {layer.name} has more than one input. This is not supported.'
k, i, f = kifs[0]
w_k, w_i, w_f = get_arr_container(layer.kernel.numpy())
k, i, f = int(k or w_k), i + w_i, f + w_f
k = int(k or w_k or np.any(layer.bias < 0)) # type: ignore
i, f = i + w_i, f + w_f
if isinstance(layer, Conv):
div = layer.filters
else:
Expand Down

0 comments on commit 8a6b1b2

Please sign in to comment.