MCPcopy Create free account
hub / github.com/boyiwei/alignment-attribution-code / __init__

Method __init__

lib/model_wrapper.py:21–29  ·  view source on GitHub ↗
(self, base: nn.Linear)

Source from the content-addressed store, hash-verified

19 """
20
21 def __init__(self, base: nn.Linear):
22 super().__init__()
23 self.base = base
24 # self.register_buffer('activation_norms', torch.zeros([base.in_features], device=self.base.weight.device, requires_grad=False))
25 self.activation_norms = torch.zeros(
26 [base.in_features], device=self.base.weight.device, requires_grad=False
27 )
28 self.n_samples = 0
29 self.record_activation = True
30
31 def clear_act_buffer(self):
32 self.activation_norms.fill_(0.0)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected