MCPcopy Create free account

hub / github.com/PABannier/sam3.cpp / functions

Functions893 in github.com/PABannier/sam3.cpp

↓ 1 callersFunctionload_config_yaml
Load SAM2 Hydra YAML config and extract hyperparameters.
convert_sam2_to_ggml.py:346
↓ 1 callersFunctionload_ggml_bnd
(path: str)
tests/dump_phase7_reference.py:54
↓ 1 callersFunctionload_ggml_masks
(path: str, h: int, w: int)
tests/dump_phase7_reference.py:60
↓ 1 callersFunctionload_ggml_tensor
Load a tensor dumped by sam3_dump_state_tensor. Returns data in ggml flat order and the ggml shape (ne[0], ne[1], ne[2], ...).
tests/compare_vit_output.py:12
↓ 1 callersFunctionload_jpeg_image
stb/stb_image.h:3865
↓ 1 callersFunctionload_meta
tests/test_phase7.cpp:62
↓ 1 callersFunctionload_prompt
tests/test_phase5.cpp:22
↓ 1 callersFunctionload_prompt_cases
(path: str)
tests/dump_phase4_reference.py:42
↓ 1 callersFunctionload_prompt_cases
tests/test_phase4.cpp:31
↓ 1 callersFunctionload_pytorch_tensor
Load a tensor saved by the Python dumper (standard row-major).
tests/compare_vit_output.py:35
↓ 1 callersFunctionload_tensor
(path: str)
tests/dump_geom_encoder_reference.py:82
↓ 1 callersFunctionload_tensor_case
tests/test_metal_flash_attn_ext_block15_compare.cpp:439
↓ 1 callersFunctionmain
()
convert_sam2_to_ggml.py:449
↓ 1 callersFunctionmain
()
convert_edgetam_to_ggml.py:519
↓ 1 callersFunctionmain
()
convert_sam3_to_ggml.py:308
↓ 1 callersFunctionmain
()
scripts/verify_tokenizer.py:153
↓ 1 callersFunctionmain
()
tests/dump_sam2_reference.py:165
↓ 1 callersFunctionmain
()
tests/dump_sam2_pvs_reference.py:33
↓ 1 callersFunctionmain
()
tests/dump_phase6_reference.py:444
↓ 1 callersFunctionmain
()
tests/dump_phase3_reference.py:153
↓ 1 callersFunctionmain
()
tests/test_sam2_e2e_all_variants.py:233
↓ 1 callersFunctionmain
()
tests/compare_mask_decoder.py:96
↓ 1 callersFunctionmain
()
tests/dump_vit_reference.py:132
↓ 1 callersFunctionmain
()
tests/dump_phase5_reference.py:146
↓ 1 callersFunctionmain
()
tests/dump_phase4_reference.py:96
↓ 1 callersFunctionmain
()
tests/dump_fenc_from_package.py:302
↓ 1 callersFunctionmain
()
tests/dump_phase7_reference.py:735
↓ 1 callersFunctionmain
()
tests/dump_geom_encoder_reference.py:388
↓ 1 callersFunctionmain
()
tests/compare_ddec_tensors.py:136
↓ 1 callersFunctionmain
()
tests/dump_reference.py:37
↓ 1 callersFunctionmain
()
tests/dump_ddec_from_package.py:124
↓ 1 callersFunctionmake_image_input
tests/test_metal_vit_prefix_compare.cpp:56
↓ 1 callersFunctionmask_iou
Compute IoU between two binary masks.
tests/compare_sam2_video.py:42
↓ 1 callersFunctionmask_iou
tests/test_visual_only_compare.cpp:17
↓ 1 callersMethodn_img_tokens
72
sam3.cpp:180
↓ 1 callersFunctionnew_tensor_4d_from_shape
tests/test_metal_vit_upstream_compare.cpp:96
↓ 1 callersFunctionnormalize_shape_4d
tests/test_metal_vit_upstream_compare.cpp:88
↓ 1 callersFunctionparse_args
tests/test_metal_conv_transpose_2d.cpp:64
↓ 1 callersFunctionparse_args
tests/test_metal_conv_transpose_2d_stress.cpp:43
↓ 1 callersFunctionparse_box
(field: str)
tests/dump_phase6_reference.py:101
↓ 1 callersFunctionparse_box
tests/test_phase6.cpp:55
↓ 1 callersFunctionparse_box
tests/test_metal_phase6.cpp:46
↓ 1 callersFunctionparse_phase6_case
tests/test_metal_python_ref_compare.cpp:126
↓ 1 callersFunctionprint_graph_row
tests/test_metal_block0_stage_compare.cpp:152
↓ 1 callersFunctionprint_graph_row
tests/test_metal_block_stage_compare.cpp:207
↓ 1 callersFunctionprint_summary
tests/test_metal_python_ref_compare.cpp:461
↓ 1 callersFunctionprint_table
examples/benchmark.cpp:400
↓ 1 callersFunctionpython_preprocess
SAM3 Python preprocessing pipeline.
tests/compare_preprocessing.py:58
↓ 1 callersFunctionrename_key
Map a SAM2 PyTorch state_dict key to a flat ggml tensor name. Returns None if the tensor should be skipped.
convert_sam2_to_ggml.py:113
↓ 1 callersFunctionrename_shared_key
Map shared component keys (FPN, SAM, memory) to ggml names. Returns None if the tensor should be skipped.
convert_edgetam_to_ggml.py:300
↓ 1 callersFunctionreshape_for_broadcast
(freqs_cis, x)
tests/dump_phase3_reference.py:60
↓ 1 callersFunctionreshape_for_broadcast
(freqs_cis, x)
tests/dump_vit_reference.py:44
↓ 1 callersFunctionreshape_for_broadcast
(freqs_cis: torch.Tensor, x: torch.Tensor)
tests/dump_phase7_reference.py:200
↓ 1 callersFunctionrun_benchmark_isolated
examples/benchmark.cpp:318
↓ 1 callersFunctionrun_cpp_variant
Run C++ ggml inference for one variant.
tests/test_sam2_e2e_all_variants.py:117
↓ 1 callersFunctionrun_memory_attention
( tracker_weights: Dict[str, torch.Tensor], curr_neck_trk_2: torch.Tensor, prompt: torch.Tensor,
tests/dump_phase7_reference.py:640
↓ 1 callersFunctionrun_memory_encoder
( tracker_weights: Dict[str, torch.Tensor], neck_trk_2: torch.Tensor, low_res_mask_logits: torch.T
tests/dump_phase7_reference.py:463
↓ 1 callersFunctionrun_obj_ptr
( tracker_weights: Dict[str, torch.Tensor], sam_token: torch.Tensor, obj_score_logit: torch.Tensor
tests/dump_phase7_reference.py:573
↓ 1 callersFunctionrun_pcs
examples/main_image.cpp:240
↓ 1 callersFunctionrun_pvs
examples/main_image.cpp:263
↓ 1 callersFunctionrun_pvs_box
examples/main_image.cpp:281
↓ 1 callersFunctionrun_python_variant
Run Python SAM2 inference for one variant.
tests/test_sam2_e2e_all_variants.py:41
↓ 1 callersFunctionrun_sam_decoder
( mask_weights: Dict[str, torch.Tensor], prompt_weights: Dict[str, torch.Tensor], image_embeddings
tests/dump_phase7_reference.py:306
↓ 1 callersFunctionsam2_bicubic_interpolate_cpu
Bicubic interpolation of a [C, H_in, W_in] tensor on CPU to [C, H_out, W_out]. Used for background positional embedding interpolation.
sam3.cpp:4076
↓ 1 callersFunctionsam2_encode_image_hiera
Full SAM2 image encoding: preprocess → Hiera → FPN → state
sam3.cpp:5861
↓ 1 callersFunctionsam2_hiera_block_forward
Single Hiera MultiScaleBlock forward pass.
sam3.cpp:4299
↓ 1 callersFunctionsam2_load_hparams
sam3.cpp:1568
↓ 1 callersFunctionsam2_precompute_hiera_metadata
Set per-block metadata: stage_idx, dim_in/out, window_size, has_q_stride
sam3.cpp:1680
↓ 1 callersFunctionsam2_print_hparams
sam3.cpp:1654
↓ 1 callersFunctionsam2_register_tensors
Register all SAM2 tensors (Hiera backbone + FPN neck + shared)
sam3.cpp:1749
↓ 1 callersFunctionsam2_window_partition
Window partition: [B, H, W, C] -> [B*nW, ws, ws, C] with padding if needed. In ggml layout: input ne = {C, W, H, B}, output ne = {C, ws, ws, B*nW}. Pa
sam3.cpp:4194
↓ 1 callersFunctionsam2_window_unpartition
Window unpartition: reverse of sam2_window_partition. Input ne = {C, ws, ws, nW*B}, output ne = {C, orig_W, orig_H, B}. Reverses the partition steps:
sam3.cpp:4244
↓ 1 callersFunctionsam3_box_iou
Compute IoU between two boxes [x0, y0, x1, y1].
sam3.cpp:9577
↓ 1 callersFunctionsam3_bpe_encode
Apply BPE merges to a byte-encoded word string. Returns space-separated BPE tokens (e.g. "he llo</w>").
sam3.cpp:1261
↓ 1 callersFunctionsam3_build_causal_mask
Build a causal (lower-triangular) attention mask for the text encoder. Returns: [L, L] F16 tensor. mask[kv][q] = 0 if kv <= q, -inf otherwise. Marked
sam3.cpp:3934
↓ 1 callersFunctionsam3_build_query_pos
Build query positional encoding from reference boxes via sine embed + ref_point_head MLP. ref_boxes: [4, NQ, 1] — after sigmoid sine_dim_t: [1, 64] Re
sam3.cpp:8243
↓ 1 callersFunctionsam3_build_sine_pos_embed_4d
Build sinusoidal positional embedding for 4D reference points in the ggml graph. ref_boxes: [4, NQ, B] — (cx, cy, w, h) after sigmoid, B=1 sine_dim_t:
sam3.cpp:8200
↓ 1 callersFunctionsam3_build_vit_attn_core_from_qkv
sam3.cpp:6782
↓ 1 callersFunctionsam3_build_vit_block_stage_from_input
sam3.cpp:6829
↓ 1 callersFunctionsam3_build_vit_prefix_stage_from_input
sam3.cpp:6720
↓ 1 callersFunctionsam3_clear_encoder_state
sam3.cpp:6218
↓ 1 callersFunctionsam3_codepoint_to_utf8
sam3.cpp:1108
↓ 1 callersFunctionsam3_compute_box_rpb
Build box-relative positional bias for DETR cross-attention. ref_boxes: [4, N_q, B] — (cx, cy, w, h) in [0,1] rpb_coords: [feat_hw] — normalized coord
sam3.cpp:8293
↓ 1 callersFunctionsam3_cxcywh_to_xyxy
Convert (cx, cy, w, h) in [0,1] to (x0, y0, x1, y1) in pixel coordinates.
sam3.cpp:9646
↓ 1 callersFunctionsam3_ddec_layer_forward
Single DETR decoder layer. queries: [D, N_q, B] where N_q = 201 (200 object queries + 1 presence token) query_pos: [D, N_q, B] positional encoding for
sam3.cpp:8438
↓ 1 callersFunctionsam3_dot_product_scoring
DotProductScoring: classify queries against text features via dot product. Python reference (DotProductScoring.forward): 1. prompt_mlp(prompt) → resi
sam3.cpp:8640
↓ 1 callersFunctionsam3_effective_feat_size
Compute feat_size for an arbitrary img_size.
sam3.cpp:249
↓ 1 callersFunctionsam3_fenc_layer_forward
Single fusion encoder layer. x: [D, N, B] image features (N=5184), prompt: [D, T, B] text/exemplar tokens, pos: [D, N, B] Returns: updated x [D, N, B]
sam3.cpp:8033
↓ 1 callersFunctionsam3_free_state
sam3.cpp:3417
↓ 1 callersFunctionsam3_get_1d_sine_pe
1-D sinusoidal PE matching Python get_1d_sine_pe(pos_inds, dim, temperature). Output: [dim] floats — first dim/2 are sin, second dim/2 are cos.
sam3.cpp:3641
↓ 1 callersFunctionsam3_init_byte_encoder
Maps each byte 0-255 to a unique unicode character (as UTF-8 string). Printable bytes map to themselves; non-printable bytes map to U+0100..U+0143.
sam3.cpp:1144
↓ 1 callersFunctionsam3_inverse_sigmoid
inverse_sigmoid: log(x / (1 - x)), clamped to avoid inf Python reference uses eps=1e-3: x1 = x.clamp(min=eps), x2 = (1-x).clamp(min=eps)
sam3.cpp:8171
↓ 1 callersFunctionsam3_load_kv_text_file
sam3.cpp:12617
↓ 1 callersFunctionsam3_load_tensors
Load tensors from the binary file into the already-registered ggml tensors
sam3.cpp:3095
↓ 1 callersFunctionsam3_mark_named_outputs
sam3.cpp:6228
↓ 1 callersFunctionsam3_mask_iou
Compute mask IoU between two binary masks.
sam3.cpp:9453
↓ 1 callersFunctionsam3_match_detections
sam3.cpp:11459
↓ 1 callersFunctionsam3_multihead_attn_fused
Standard multi-head attention with fused in_proj. q_in, k_in, v_in: [D, N, B] (if fused_qkv, only q_in is used and contains QKV stacked) in_proj_w: [
sam3.cpp:7502
↓ 1 callersFunctionsam3_nms
Non-maximum suppression on detections, sorted by score descending. Returns indices of kept detections.
sam3.cpp:9591
↓ 1 callersFunctionsam3_pixel_decoder
Build pixel decoder: progressively upsample FPN features. fpn_feats[0]: [D, 288, 288, B] (highest res) fpn_feats[1]: [D, 144, 144, B] fpn_feats[2]: [D
sam3.cpp:8899
← previousnext →501–600 of 893, ranked by callers