MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / build_inp

Method build_inp

subprojects/llama.cpp/tools/mtmd/clip.cpp:452–462  ·  view source on GitHub ↗

build the input after conv2d (inp_raw --> patches) returns tensor with shape [n_embd, n_patches]

Source from the content-addressed store, hash-verified

450// build the input after conv2d (inp_raw --> patches)
451// returns tensor with shape [n_embd, n_patches]
452ggml_tensor * clip_graph::build_inp() {
453 ggml_tensor * inp_raw = build_inp_raw();
454 ggml_tensor * inp = ggml_conv_2d(ctx0, model.patch_embeddings_0, inp_raw, patch_size, patch_size, 0, 0, 1, 1);
455 inp = ggml_reshape_2d(ctx0, inp, n_patches, n_embd);
456 inp = ggml_cont(ctx0, ggml_transpose(ctx0, inp));
457 if (model.patch_bias) {
458 inp = ggml_add(ctx0, inp, model.patch_bias);
459 cb(inp, "patch_bias", -1);
460 }
461 return inp;
462}
463
464ggml_tensor * clip_graph::build_inp_raw(int channels) {
465 ggml_tensor * inp_raw = ggml_new_tensor_3d(ctx0, GGML_TYPE_F32, img.nx, img.ny, channels);

Callers

nothing calls this directly

Calls 5

ggml_conv_2dFunction · 0.85
ggml_reshape_2dFunction · 0.85
ggml_contFunction · 0.85
ggml_transposeFunction · 0.85
ggml_addFunction · 0.85

Tested by

no test coverage detected