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

Function graph_conv_module

src/framework/audio/zipenhancer.cpp:647–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645}
646
647core::TensorValue graph_conv_module(
648 core::ModuleBuildContext & ctx,
649 const core::TensorValue & x,
650 const std::unordered_map<std::string, Param> & params,
651 const std::string & prefix,
652 const std::string & which) {
653 const std::string base = prefix + "." + which;
654 auto p = graph_linear(ctx, x, params, base + ".in_proj", 128);
655 auto lhs = modules::SliceModule({2, 0, kDense}).build(ctx, p);
656 auto rhs = modules::SliceModule({2, kDense, kDense}).build(ctx, p);
657 auto gated = graph_mul(ctx, lhs, modules::SigmoidModule().build(ctx, rhs));
658 auto channel_first = graph_transpose(ctx, gated, {{1, 2, 0, 3}}, 3);
659 auto conv = graph_depthwise_conv1d(
660 ctx,
661 channel_first,
662 require_param(params, base + ".depthwise_conv.weight"),
663 require_param(params, base + ".depthwise_conv.bias"),
664 base + ".depthwise_conv");
665 conv = graph_swoosh_r(ctx, conv);
666 auto seq_first = graph_transpose(ctx, conv, {{2, 0, 1, 3}}, 3);
667 return graph_linear(ctx, seq_first, params, base + ".out_proj", kDense);
668}
669
670core::TensorValue graph_bias_norm(
671 core::ModuleBuildContext & ctx,

Callers 1

graph_zipformer_layerFunction · 0.85

Calls 8

SliceModuleClass · 0.85
SigmoidModuleClass · 0.85
graph_depthwise_conv1dFunction · 0.85
graph_swoosh_rFunction · 0.85
graph_linearFunction · 0.70
graph_mulFunction · 0.70
graph_transposeFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected