MCPcopy Create free account
hub / github.com/evilsocket/cake / forward

Method forward

cake-core/src/models/luxtts/bypass_module.rs:35–40  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)]

Callers 3

test_bypass_zero_scaleFunction · 0.45
test_bypass_one_scaleFunction · 0.45
test_bypass_half_scaleFunction · 0.45

Calls

no outgoing calls

Tested by 3

test_bypass_zero_scaleFunction · 0.36
test_bypass_one_scaleFunction · 0.36
test_bypass_half_scaleFunction · 0.36