MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / sam3_bbox_mlp

Function sam3_bbox_mlp

sam3.cpp:8184–8194  ·  view source on GitHub ↗

Box refinement MLP (3 layers: D→D→D→4 with ReLU)

Source from the content-addressed store, hash-verified

8182
8183// Box refinement MLP (3 layers: D→D→D→4 with ReLU)
8184static struct ggml_tensor* sam3_bbox_mlp(struct ggml_context* ctx,
8185 struct ggml_tensor* x,
8186 struct ggml_tensor* w[3],
8187 struct ggml_tensor* b[3]) {
8188 for (int j = 0; j < 3; ++j) {
8189 x = ggml_mul_mat(ctx, w[j], x);
8190 x = ggml_add(ctx, x, b[j]);
8191 if (j < 2) x = ggml_relu(ctx, x);
8192 }
8193 return x;
8194}
8195
8196// Build sinusoidal positional embedding for 4D reference points in the ggml graph.
8197// ref_boxes: [4, NQ, B] — (cx, cy, w, h) after sigmoid, B=1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected