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

Function zero_like_frames

src/models/vibevoice/tokenizer_audio.cpp:407–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407core::TensorValue zero_like_frames(core::ModuleBuildContext & ctx, const core::TensorValue & input, int64_t frames) {
408 if (frames <= 0) {
409 throw std::runtime_error("VibeVoice tokenizer zero frame template requires positive frame count");
410 }
411 auto one = modules::SliceModule({2, 0, 1}).build(ctx, input);
412 if (one.type != GGML_TYPE_F32) {
413 one = core::wrap_tensor(ggml_cast(ctx.ggml, one.tensor, GGML_TYPE_F32), one.shape, GGML_TYPE_F32);
414 }
415 auto repeated = modules::RepeatModule({
416 core::TensorShape::from_dims({input.shape.dims[0], input.shape.dims[1], frames})}).build(ctx, one);
417 return core::wrap_tensor(ggml_scale(ctx.ggml, repeated.tensor, 0.0F), repeated.shape, GGML_TYPE_F32);
418}
419
420core::TensorValue constant_pad_frames(
421 core::ModuleBuildContext & ctx,

Callers 1

constant_pad_framesFunction · 0.85

Calls 6

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

Tested by

no test coverage detected