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

Function zeros_like_prefix

src/framework/modules/streaming_conv_modules.cpp:57–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 auto repeated = core::wrap_tensor(ggml_repeat(ctx.ggml, bias_view.tensor, output_contiguous.tensor), output.shape, GGML_TYPE_F32);
56 return core::wrap_tensor(ggml_add(ctx.ggml, output_contiguous.tensor, repeated.tensor), output.shape, GGML_TYPE_F32);
57}
58
59core::TensorValue zeros_like_prefix(
60 core::ModuleBuildContext & ctx,
61 const core::TensorValue & input,
62 int64_t prefix_frames) {
63 auto prefix = RepeatModule({core::TensorShape::from_dims({input.shape.dims[0], input.shape.dims[1], prefix_frames})})
64 .build(ctx, SliceModule({2, 0, 1}).build(ctx, input));
65 auto prefix_contiguous = tensor_layout::ensure_contiguous_layout_if_needed(ctx, prefix);
66 return core::wrap_tensor(ggml_scale(ctx.ggml, prefix_contiguous.tensor, 0.0f), prefix.shape, GGML_TYPE_F32);
67}
68

Callers 1

buildMethod · 0.70

Calls 6

RepeatModuleClass · 0.85
SliceModuleClass · 0.85
wrap_tensorFunction · 0.85
ggml_scaleFunction · 0.85
buildMethod · 0.45

Tested by

no test coverage detected