mirror of
https://github.com/p-e-w/heretic.git
synced 2026-10-02 08:51:27 -07:00
fix: use W_org matrix only where needed (#398)
* fix: minor change use `W_org` matrix where needed... * Update model.py * Update model.py * fix: Windows hash, remove BOM marker * docs: Add info about test cases * feat: Tests for row_normalization PRE & NONE * feat: CI hash files for row_normalization PRE & NONE models * feat: Documentation instructions about test suite * add recommendation
This commit is contained in:
@@ -555,9 +555,11 @@ class Model:
|
||||
# Flatten weight matrix to (out_features, in_features).
|
||||
W = W.view(W.shape[0], -1)
|
||||
|
||||
if self.settings.row_normalization != RowNormalization.NONE:
|
||||
if self.settings.row_normalization == RowNormalization.FULL:
|
||||
# Keep a reference to the original weight matrix so we can subtract it later.
|
||||
W_org = W
|
||||
|
||||
if self.settings.row_normalization != RowNormalization.NONE:
|
||||
# Get the row norms.
|
||||
W_row_norms = LA.vector_norm(W, dim=1, keepdim=True)
|
||||
# Normalize the weight matrix along the rows.
|
||||
|
||||
Reference in New Issue
Block a user