| 129 | } |
| 130 | |
| 131 | LinearWeights load_linear( |
| 132 | core::BackendWeightStore & store, |
| 133 | const assets::TensorSource & source, |
| 134 | const std::string & prefix, |
| 135 | int64_t out_features, |
| 136 | int64_t in_features, |
| 137 | bool use_bias, |
| 138 | assets::TensorStorageType storage_type) { |
| 139 | (void) storage_type; |
| 140 | LinearWeights linear; |
| 141 | linear.out_features = out_features; |
| 142 | linear.in_features = in_features; |
| 143 | linear.use_bias = use_bias; |
| 144 | linear.weight = source.require_f32(prefix + ".weight", {out_features, in_features}); |
| 145 | linear.weight_tensor = store.make_from_f32( |
| 146 | core::TensorShape::from_dims({out_features, in_features}), |
| 147 | assets::TensorStorageType::F32, |
| 148 | linear.weight); |
| 149 | if (use_bias) { |
| 150 | linear.bias = source.require_f32(prefix + ".bias", {out_features}); |
| 151 | linear.bias_tensor = store.make_from_f32(core::TensorShape::from_dims({out_features}), assets::TensorStorageType::F32, linear.bias); |
| 152 | } |
| 153 | return linear; |
| 154 | } |
| 155 | |
| 156 | SnakeWeights load_snake( |
| 157 | core::BackendWeightStore & store, |
no test coverage detected