| 13708 | } |
| 13709 | |
| 13710 | bool sam3_test_dump_phase6_from_ref_inputs(const sam3_model& model, |
| 13711 | const std::string& prephase_ref_dir, |
| 13712 | const sam3_pvs_params& params, |
| 13713 | const std::string& output_dir, |
| 13714 | int n_threads) { |
| 13715 | const auto& hp = model.hparams; |
| 13716 | const int D = hp.sam_embed_dim; |
| 13717 | const int H = hp.n_img_embd(); |
| 13718 | const int H1 = H * 2; |
| 13719 | const int H0 = H * 4; |
| 13720 | |
| 13721 | std::vector<float> neck_trk_0; |
| 13722 | std::vector<float> neck_trk_1; |
| 13723 | std::vector<float> neck_trk_2; |
| 13724 | if (!sam3_load_ref_f32_data(prephase_ref_dir + "/neck_trk_0", neck_trk_0, D * H0 * H0) || |
| 13725 | !sam3_load_ref_f32_data(prephase_ref_dir + "/neck_trk_1", neck_trk_1, D * H1 * H1) || |
| 13726 | !sam3_load_ref_f32_data(prephase_ref_dir + "/neck_trk_2", neck_trk_2, D * H * H)) { |
| 13727 | return false; |
| 13728 | } |
| 13729 | |
| 13730 | neck_trk_0 = sam3_reorder_nchw_to_ggml_dwh(neck_trk_0, D, H0, H0); |
| 13731 | neck_trk_1 = sam3_reorder_nchw_to_ggml_dwh(neck_trk_1, D, H1, H1); |
| 13732 | neck_trk_2 = sam3_reorder_nchw_to_ggml_dwh(neck_trk_2, D, H, H); |
| 13733 | |
| 13734 | return sam3_test_dump_phase6_impl(model, |
| 13735 | nullptr, nullptr, nullptr, |
| 13736 | &neck_trk_0, &neck_trk_1, &neck_trk_2, |
| 13737 | params, output_dir, n_threads); |
| 13738 | } |
| 13739 | |
| 13740 | /***************************************************************************** |
| 13741 | ** Test: Geometry encoder dump |