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

Function save_ref_f32

tests/test_metal_python_ref_compare.cpp:264–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264static bool save_ref_f32(const std::string & path,
265 const std::vector<float> & data,
266 const std::vector<int> & shape) {
267 FILE * shape_f = fopen((path + ".shape").c_str(), "w");
268 if (!shape_f) {
269 return false;
270 }
271 for (size_t i = 0; i < shape.size(); ++i) {
272 fprintf(shape_f, "%s%d", i == 0 ? "" : ",", shape[i]);
273 }
274 fclose(shape_f);
275
276 FILE * data_f = fopen((path + ".bin").c_str(), "wb");
277 if (!data_f) {
278 return false;
279 }
280 const size_t n_written = fwrite(data.data(), sizeof(float), data.size(), data_f);
281 fclose(data_f);
282 return n_written == data.size();
283}
284
285static bool export_dump_as_nchw_ref(const std::string & ggml_dump_path,
286 const std::string & out_path) {

Callers 1

export_dump_as_nchw_refFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected