(self, x)
| 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 | |
| 46 | class no_act_recording: |
nothing calls this directly
no outgoing calls
no test coverage detected