Apply bypass: output = x + scale * (module_out - x) bypass_scale is the weight on the non-residual (processed) path
(&self, x: &Tensor, module_out: &Tensor)
| 33 | /// Apply bypass: output = x + scale * (module_out - x) |
| 34 | /// bypass_scale is the weight on the non-residual (processed) path |
| 35 | pub fn forward(&self, x: &Tensor, module_out: &Tensor) -> Result<Tensor> { |
| 36 | // At inference, no clamping — use raw bypass_scale |
| 37 | let diff = (module_out - x)?; |
| 38 | let scaled = diff.broadcast_mul(&self.scale)?; |
| 39 | Ok((x + scaled)?) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | #[cfg(test)] |
no outgoing calls