| 179 | } |
| 180 | |
| 181 | core::TensorValue dynamic_tanh_norm( |
| 182 | core::ModuleBuildContext & ctx, |
| 183 | const core::TensorValue & input, |
| 184 | const StableAudioSameNormWeights & weights) { |
| 185 | const int64_t dim = input.shape.last_dim(); |
| 186 | auto alpha = broadcast_scalar(ctx, weights.alpha, input); |
| 187 | auto hidden = modules::MulModule{}.build(ctx, input, alpha); |
| 188 | hidden = modules::TanhModule{}.build(ctx, hidden); |
| 189 | auto gamma = broadcast_last_dim(ctx, weights.gamma, hidden, dim); |
| 190 | auto beta = broadcast_last_dim(ctx, weights.beta, hidden, dim); |
| 191 | hidden = modules::MulModule{}.build(ctx, hidden, gamma); |
| 192 | return modules::AddModule{}.build(ctx, hidden, beta); |
| 193 | } |
| 194 | |
| 195 | core::TensorValue reshape_heads( |
| 196 | core::ModuleBuildContext & ctx, |
no test coverage detected