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

Function se_res2net

src/models/qwen3_tts/speaker_encoder.cpp:195–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195core::TensorValue se_res2net(
196 core::ModuleBuildContext & ctx,
197 const core::TensorValue & input,
198 const SERes2NetWeights & block,
199 common::ConstantTensorCache & constants) {
200 auto y = tdnn(ctx, input, block.tdnn1, constants);
201 core::TensorValue merged;
202 core::TensorValue previous;
203 constexpr int64_t scale = 8;
204 constexpr int64_t width = 64;
205 for (int64_t i = 0; i < scale; ++i) {
206 auto chunk = modules::SliceModule({1, i * width, width}).build(ctx, y);
207 core::TensorValue out;
208 if (i == 0) {
209 out = chunk;
210 } else if (i == 1) {
211 out = tdnn(ctx, chunk, block.res2net[0], constants);
212 } else {
213 out = tdnn(ctx, modules::ResidualAddModule{}.build(ctx, chunk, previous), block.res2net[static_cast<size_t>(i - 1)], constants);
214 }
215 previous = out;
216 merged = merged.valid() ? modules::ConcatModule({1}).build(ctx, merged, out) : out;
217 }
218 y = tdnn(ctx, merged, block.tdnn2, constants);
219 y = modules::SqueezeExcite1dModule({512, 128, true}).build(
220 ctx,
221 y,
222 {binding::conv1d_data(constants, block.se_conv1.weight, block.se_conv1.bias),
223 binding::conv1d_data(constants, block.se_conv2.weight, block.se_conv2.bias)});
224 return modules::ResidualAddModule{}.build(ctx, y, input);
225}
226
227core::TensorValue attentive_statistics_pool(
228 core::ModuleBuildContext & ctx,

Callers 1

Calls 7

tdnnFunction · 0.85
SliceModuleClass · 0.85
ConcatModuleClass · 0.85
conv1d_dataFunction · 0.85
validMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected