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

Function causal_conv1d

src/models/heartmula/codec.cpp:524–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522 0,
523 1,
524 weights.bias.has_value(),
525 }).build(ctx, input, weights);
526 return modules::SliceModule({2, 0, output.shape.dims[2] - stride}).build(ctx, output);
527}
528
529core::TensorValue prelu(
530 core::ModuleBuildContext & ctx,
531 const core::TensorValue & input,
532 const HeartCodecPreluWeights & weights) {
533 auto positive = core::wrap_tensor(ggml_relu(ctx.ggml, core::ensure_backend_addressable_layout(ctx, input).tensor), input.shape, GGML_TYPE_F32);
534 auto negative = core::wrap_tensor(ggml_sub(ctx.ggml, input.tensor, positive.tensor), input.shape, GGML_TYPE_F32);
535 auto alpha = core::reshape_tensor(ctx, weights.weight, core::TensorShape::from_dims({1, 1, 1}));
536 auto alpha_rep = core::wrap_tensor(ggml_repeat(ctx.ggml, alpha.tensor, input.tensor), input.shape, GGML_TYPE_F32);
537 return modules::AddModule{}.build(ctx, positive, modules::MulModule{}.build(ctx, negative, alpha_rep));
538}
539
540core::TensorValue adjacent_repeat_frames_bct(
541 core::ModuleBuildContext & ctx,
542 const core::TensorValue & input,
543 int64_t repeat) {
544 auto btc = modules::TransposeModule({{0, 2, 1}, 3}).build(ctx, input);
545 btc = core::ensure_backend_addressable_layout(ctx, btc);
546 auto bt1c = core::reshape_tensor(

Callers 2

scalar_residual_unitFunction · 0.70
scalar_decoderFunction · 0.70

Calls 3

causal_left_pad_bctFunction · 0.85
Conv1dModuleClass · 0.85
buildMethod · 0.45

Tested by

no test coverage detected