MCPcopy Create free account
hub / github.com/antirez/ds4 / model_map_span_vec_include_layer_decode_static

Function model_map_span_vec_include_layer_decode_static

ds4.c:4229–4264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4227static uint64_t required_u64_compat(const ds4_model *m, const char *key) {
4228 uint64_t v = 0;
4229 if (!model_get_u64_compat(m, key, &v)) {
4230 fprintf(stderr, "ds4: required metadata key is missing: %s\n", key);
4231 exit(1);
4232 }
4233 return v;
4234}
4235
4236static float required_f32(const ds4_model *m, const char *key) {
4237 float v = 0.0f;
4238 if (!model_get_f32_compat(m, key, &v)) {
4239 fprintf(stderr, "ds4: required metadata key is missing: %s\n", key);
4240 exit(1);
4241 }
4242 return v;
4243}
4244
4245static bool required_bool(const ds4_model *m, const char *key) {
4246 bool v = false;
4247 if (!model_get_bool(m, key, &v)) {
4248 fprintf(stderr, "ds4: required metadata key is missing: %s\n", key);
4249 exit(1);
4250 }
4251 return v;
4252}
4253
4254static ds4_tensor *required_tensor(const ds4_model *m, const char *name) {
4255 ds4_tensor *t = model_find_tensor(m, name);
4256 if (!t) {
4257 fprintf(stderr, "ds4: required tensor is missing: %s\n", name);
4258 exit(1);
4259 }
4260 return t;
4261}
4262
4263static ds4_tensor *tensor_by_namef(const ds4_model *m, const char *fmt, uint32_t layer) {
4264 char name[128];
4265 int n = snprintf(name, sizeof(name), fmt, layer);
4266 if (n < 0 || (size_t)n >= sizeof(name)) ds4_die("tensor name is too long");
4267 return model_find_tensor(m, name);

Calls

no outgoing calls

Tested by

no test coverage detected