build the input after conv2d (inp_raw --> patches) returns tensor with shape [n_embd, n_patches]
| 450 | // build the input after conv2d (inp_raw --> patches) |
| 451 | // returns tensor with shape [n_embd, n_patches] |
| 452 | ggml_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 | |
| 464 | ggml_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); |
nothing calls this directly
no test coverage detected