MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / swiglu_ff

Function swiglu_ff

src/models/stable_audio/rf_dit.cpp:312–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312core::TensorValue swiglu_ff(
313 core::ModuleBuildContext & ctx,
314 const core::TensorValue & input,
315 const StableAudioRfFeedForwardWeights & weights,
316 const StableAudioConfig & config) {
317 auto projected = modules::LinearModule({config.embed_dim, 2 * ff_inner_dim(config), true, GGML_PREC_F32})
318 .build(ctx, input, weights.in_proj);
319 auto value = modules::SliceModule({2, 0, ff_inner_dim(config)}).build(ctx, projected);
320 auto gate = modules::SliceModule({2, ff_inner_dim(config), ff_inner_dim(config)}).build(ctx, projected);
321 gate = modules::SiluModule{}.build(ctx, gate);
322 auto hidden = modules::MulModule{}.build(ctx, value, gate);
323 return modules::LinearModule({ff_inner_dim(config), config.embed_dim, true, GGML_PREC_F32})
324 .build(ctx, hidden, weights.out_proj);
325}
326
327core::TensorValue build_local_embedding(
328 core::ModuleBuildContext & ctx,

Callers 1

build_rf_layerFunction · 0.70

Calls 4

LinearModuleClass · 0.85
SliceModuleClass · 0.85
ff_inner_dimFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected