Method
adaln_modulate
(
&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 { |