Skip to content

Commit

Permalink
Cast rotation matrix to the weight dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomlago committed Jan 13, 2025
1 parent 32c9087 commit 82287b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/brevitas/graph/equalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,9 @@ def _apply_rotate(
print("Skipping layers")
continue

# Cast rotation matrix to the weight dtype
dtype = next(model.parameters()).dtype
rot_mat = rot_mat.to(dtype=dtype)
# If the rotation is not fused, redefine as a Parameter, to enable its optimization
if not insert_rotation_module and not fuse_rotations:
rot_mat = torch.nn.Parameter(rot_mat)
Expand Down

0 comments on commit 82287b0

Please sign in to comment.