| 44 | }; |
| 45 | |
| 46 | modules::LinearWeights load_linear( |
| 47 | core::BackendWeightStore & store, |
| 48 | const assets::TensorSource & source, |
| 49 | const std::string & prefix, |
| 50 | assets::TensorStorageType storage_type, |
| 51 | int64_t out_features, |
| 52 | int64_t in_features, |
| 53 | bool use_bias) { |
| 54 | modules::LinearWeights weights; |
| 55 | weights.weight = store.load_tensor(source, prefix + ".weight", storage_type, {out_features, in_features}); |
| 56 | if (use_bias) { |
| 57 | weights.bias = store.load_f32_tensor(source, prefix + ".bias", {out_features}); |
| 58 | } |
| 59 | return weights; |
| 60 | } |
| 61 | |
| 62 | modules::LinearWeights load_linear_as_shape( |
| 63 | core::BackendWeightStore & store, |
no test coverage detected