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

Function add_bias_bct

src/framework/modules/streaming_conv_modules.cpp:43–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 return (input_frames + 2 * config.padding - config.dilation * (config.kernel_size - 1) - 1) / config.stride + 1;
42}
43
44core::TensorValue add_bias_bct(
45 core::ModuleBuildContext & ctx,
46 const core::TensorValue & output,
47 int64_t channels,
48 const std::optional<core::TensorValue> & bias) {
49 if (!bias.has_value()) {
50 return output;
51 }
52 auto output_contiguous = tensor_layout::ensure_contiguous_layout_if_needed(ctx, output);
53 auto bias_view = core::reshape_tensor(ctx, *bias, core::TensorShape::from_dims({1, channels, 1}));
54 auto repeated = core::wrap_tensor(ggml_repeat(ctx.ggml, bias_view.tensor, output_contiguous.tensor), output.shape, GGML_TYPE_F32);
55 return core::wrap_tensor(ggml_add(ctx.ggml, output_contiguous.tensor, repeated.tensor), output.shape, GGML_TYPE_F32);
56}
57
58core::TensorValue zeros_like_prefix(

Callers 1

buildMethod · 0.85

Calls 5

reshape_tensorFunction · 0.85
wrap_tensorFunction · 0.85
ggml_repeatFunction · 0.85
ggml_addFunction · 0.85

Tested by

no test coverage detected