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

Function build_l2_normalized_rows

src/models/vevo2/components.cpp:878–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876 0,
877 1,
878 weights.quantizer.in_project.bias.has_value(),
879 }).build(ctx, hidden_bdt, weights.quantizer.in_project);
880 auto projected_btd = engine::modules::TransposeModule({{0, 2, 1, 3}, 3}).build(ctx, projected_bdt);
881 auto flat = engine::core::reshape_tensor(
882 ctx,
883 engine::core::ensure_backend_addressable_layout(ctx, projected_btd),
884 engine::core::TensorShape::from_dims({projected_btd.shape.dims[1], config.codebook_dim}));
885 auto normalized = build_l2_normalized_rows(ctx, flat);
886 auto logits = engine::modules::LinearModule({
887 config.codebook_dim,
888 config.codebook_size,
889 false,
890 GGML_PREC_F32,
891 }).build(ctx, normalized, {weights.quantizer.codebook, std::nullopt});
892 auto ids = engine::core::wrap_tensor(
893 ggml_argmax(ctx.ggml, engine::core::ensure_backend_addressable_layout(ctx, logits).tensor),
894 engine::core::TensorShape::from_dims({projected_btd.shape.dims[1]}),
895 GGML_TYPE_I32);
896 return engine::core::reshape_tensor(
897 ctx,
898 ids,
899 engine::core::TensorShape::from_dims({1, projected_btd.shape.dims[1]}));

Callers 1

build_coco_quantizer_idsFunction · 0.85

Calls 9

wrap_tensorFunction · 0.85
ggml_mulFunction · 0.85
ReduceSumModuleClass · 0.85
ggml_sqrtFunction · 0.85
ggml_scale_biasFunction · 0.85
ggml_divFunction · 0.85
ensure_contiguousFunction · 0.70
repeat_likeFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected