| 63 | void operator()(ggml_context * ctx) const noexcept { |
| 64 | if (ctx != nullptr) { |
| 65 | ggml_free(ctx); |
| 66 | } |
| 67 | } |
| 68 | }; |
| 69 | |
| 70 | modules::LinearWeights load_linear( |
| 71 | core::BackendWeightStore & store, |
| 72 | const assets::TensorSource & source, |
| 73 | const std::string & prefix, |
| 74 | assets::TensorStorageType storage_type, |
| 75 | int64_t out_features, |
| 76 | int64_t in_features, |
| 77 | bool use_bias) { |
| 78 | modules::LinearWeights weights; |
| 79 | weights.weight = store.load_tensor(source, prefix + ".weight", storage_type, {out_features, in_features}); |
| 80 | if (use_bias) { |
| 81 | weights.bias = store.load_f32_tensor(source, prefix + ".bias", {out_features}); |
| 82 | } |
no test coverage detected