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

Method forward

main_low_rank_diff.py:32–43  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

30 self.activation_norms = []
31
32 def forward(self, x):
33 if self.record_activation:
34 if hasattr(self, "mask") and self.mask is not None:
35 x_ = x[self.mask] # num * dim
36 else:
37 x_ = x # bs * seq_len * dim
38 self.activation_norms.append(
39 x_.view(-1, x_.shape[-1]).cpu()
40 ) # offload to CPU.
41
42 out = self.base(x)
43 return out
44
45
46class no_act_recording:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected