Skip to content

Commit

Permalink
Remove 3x3 mode padding to bandwidth
Browse files Browse the repository at this point in the history
The padding is unnecessary because we already pad the cin to 32 and the
height and width in 3x3 mode is 3 so the last dim is 3x3x32 = 288 which
is exactly the bandwidth, so no padding needed.
  • Loading branch information
lukamac committed Dec 10, 2024
1 parent d1afd9c commit 5cfb6ab
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions test/NeurekaV2Weight.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,6 @@ def encode(
# (cout, cinMajor, Bits, Flattened spatial, cinSubtile)
weight = weight.transpose(0, 1, 4, 3, 2)

# Pad bits to fit into weight bandwidth
if height == 3 and width == 3:
# (cout * cinMajor * Bits, H * W * cinSubtile)
weight = weight.reshape(-1, height * width * cinSubtile)
# Pad only the last dimension to weight bandwidth size
# (-1, Weight Bandwidth Bits)
weight = np.pad(
weight,
((0, 0), (0, NeurekaV2Weight._WEIGHT_BANDWIDTH - weight.shape[-1])),
"constant",
constant_values=0,
)

# Pack bits into bytes
# (-1, 8)
weight = weight.reshape(-1, 8)
Expand Down

0 comments on commit 5cfb6ab

Please sign in to comment.