| 33 | |
| 34 | template <typename T> |
| 35 | void* LoadData(const std::string& file_name, int len, bool is_float) { |
| 36 | T* data = (T*)malloc(len * sizeof(T)); |
| 37 | FILE* fp = fopen(file_name.c_str(), "r"); |
| 38 | // std::cout << "file_name = " << file_name << ", fp = " << fp << std::endl; |
| 39 | for (auto i = 0; i < len; i++) { |
| 40 | float x = 0; |
| 41 | fscanf(fp, "%f", &x); |
| 42 | data[i] = is_float ? x : (int)x; |
| 43 | } |
| 44 | fclose(fp); |
| 45 | __global_weight[put_cnt++] = data; |
| 46 | return (void*)data; |
| 47 | } |
| 48 | |
| 49 | float* LoadCon2dWeightPreLoad(const std::string& name, int len) { |
| 50 | auto file_name = "../../model/resnet50_weight/resnet50_" + name + "_weight.txt"; |
nothing calls this directly
no outgoing calls
no test coverage detected