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

Function build_feed_forward

src/framework/modules/hubert_encoder.cpp:234–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 const core::TensorValue & hidden_btc,
233 const HubertEncoderWeights & weights,
234 int64_t layer_index) {
235 const auto & config = weights.config;
236 const std::string prefix = "encoder.layers." + std::to_string(layer_index) + ".feed_forward";
237 auto x = LinearModule({config.hidden_size, config.intermediate_size, true, GGML_PREC_F32})
238 .build(ctx, hidden_btc, linear_weights(weights, prefix + ".intermediate_dense"));
239 x = GeluModule({GeluApproximation::ExactErf}).build(ctx, x);
240 return LinearModule({config.intermediate_size, config.hidden_size, true, GGML_PREC_F32})
241 .build(ctx, x, linear_weights(weights, prefix + ".output_dense"));
242}
243
244core::TensorValue build_hubert_graph(
245 core::ModuleBuildContext & ctx,
246 const core::TensorValue & input_values,
247 const HubertEncoderWeights & weights) {
248 const auto & config = weights.config;
249 auto hidden = core::reshape_tensor(

Callers 1

build_hubert_graphFunction · 0.70

Calls 5

LinearModuleClass · 0.85
GeluModuleClass · 0.85
linear_weightsFunction · 0.70
to_stringFunction · 0.50
buildMethod · 0.45

Tested by

no test coverage detected