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

Method adaln_modulate

cake-core/src/backends/cpu/mod.rs:274–285  ·  view source on GitHub ↗
(
        &self,
        x: &Tensor,
        norm_weight: &Tensor,
        scale: &Tensor,
        shift: &Tensor,
        eps: f32,
    )

Source from the content-addressed store, hash-verified

272 }
273
274 fn adaln_modulate(
275 &self,
276 x: &Tensor,
277 norm_weight: &Tensor,
278 scale: &Tensor,
279 shift: &Tensor,
280 eps: f32,
281 ) -> Result<Tensor> {
282 // rms_norm(x) * (1 + scale) + shift
283 let n = candle_nn::ops::rms_norm(&x.contiguous()?, norm_weight, eps)?;
284 n.broadcast_mul(&(scale + 1.0)?)? + shift
285 }
286
287 fn sigmoid(&self, x: &Tensor) -> Result<Tensor> {
288 if x.dtype() == DType::F32 {

Callers 4

forwardMethod · 0.45

Calls 1

rms_normFunction · 0.85

Tested by 2