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

Function load_shape_file

tests/test_utils.h:50–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50static inline std::vector<int> load_shape_file(const std::string & path) {
51 std::vector<int> shape;
52 std::ifstream f(path);
53 if (!f) {
54 return shape;
55 }
56
57 std::string line;
58 std::getline(f, line);
59 size_t pos = 0;
60 while (pos < line.size()) {
61 size_t end = line.find(',', pos);
62 if (end == std::string::npos) {
63 end = line.size();
64 }
65 shape.push_back(std::stoi(line.substr(pos, end - pos)));
66 pos = end + 1;
67 }
68 return shape;
69}
70
71static inline ref_tensor_f32 load_ref_f32(const std::string & path) {
72 ref_tensor_f32 t;

Callers 2

load_ref_f32Function · 0.85
load_ref_i32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected