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

Function graph_zipformer_layer

src/framework/audio/zipenhancer.cpp:692–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692core::TensorValue graph_zipformer_layer(
693 core::ModuleBuildContext & ctx,
694 std::vector<GraphConstant> & constants,
695 const core::TensorValue & input,
696 const std::unordered_map<std::string, Param> & params,
697 const std::string & prefix) {
698 const auto orig = input;
699 auto attn = graph_attention_weights(ctx, constants, input, params, prefix);
700 auto x = graph_add(ctx, input, graph_feed_forward(ctx, input, params, prefix, "feed_forward1", 192));
701 x = graph_add(ctx, x, graph_nonlin_attention(ctx, x, attn.front(), params, prefix));
702 x = graph_add(ctx, x, graph_self_attention(ctx, x, attn, params, prefix, "self_attn1"));
703 x = graph_add(ctx, x, graph_conv_module(ctx, x, params, prefix, "conv_module1"));
704 x = graph_add(ctx, x, graph_feed_forward(ctx, x, params, prefix, "feed_forward2", 256));
705 x = graph_bypass(ctx, orig, x, require_param(params, prefix + ".bypass_mid.bypass_scale"));
706 x = graph_add(ctx, x, graph_self_attention(ctx, x, attn, params, prefix, "self_attn2"));
707 x = graph_add(ctx, x, graph_conv_module(ctx, x, params, prefix, "conv_module2"));
708 x = graph_add(ctx, x, graph_feed_forward(ctx, x, params, prefix, "feed_forward3", 320));
709 x = graph_bias_norm(ctx, x, params, prefix);
710 return graph_bypass(ctx, orig, x, require_param(params, prefix + ".bypass.bypass_scale"));
711}
712
713std::vector<float> softmax_values(const Param & bias) {
714 const float max_value = *std::max_element(bias.values.begin(), bias.values.end());

Callers 1

graph_run_dual_encoderFunction · 0.85

Calls 8

graph_attention_weightsFunction · 0.85
graph_feed_forwardFunction · 0.85
graph_nonlin_attentionFunction · 0.85
graph_self_attentionFunction · 0.85
graph_conv_moduleFunction · 0.85
graph_bypassFunction · 0.85
graph_bias_normFunction · 0.85
graph_addFunction · 0.70

Tested by

no test coverage detected