| 240 | } |
| 241 | |
| 242 | WeightNormConv1dWeights load_weight_norm_conv1d( |
| 243 | core::BackendWeightStore & store, |
| 244 | const assets::TensorSource & source, |
| 245 | const std::string & prefix, |
| 246 | int64_t out_channels, |
| 247 | int64_t in_channels, |
| 248 | int64_t kernel, |
| 249 | int stride, |
| 250 | int padding, |
| 251 | int dilation, |
| 252 | assets::TensorStorageType storage_type, |
| 253 | bool use_bias) { |
| 254 | const auto g = source.require_f32(prefix + ".weight_g", {out_channels, 1, 1}); |
| 255 | const auto v = source.require_f32(prefix + ".weight_v", {out_channels, in_channels, kernel}); |
| 256 | const auto graph_storage_type = |
| 257 | compatible_regular_conv_storage_type(source, prefix + ".weight_v", storage_type); |
| 258 | WeightNormConv1dWeights out = {}; |
| 259 | out.stride = stride; |
| 260 | out.padding = padding; |
| 261 | out.dilation = dilation; |
| 262 | out.conv.weight = store.make_from_f32( |
| 263 | core::TensorShape::from_dims({out_channels, in_channels, kernel}), |
| 264 | graph_storage_type, |
| 265 | apply_weight_norm(g, v, out_channels, in_channels * kernel)); |
| 266 | if (use_bias) { |
| 267 | out.conv.bias = store.load_f32_tensor(source, prefix + ".bias", {out_channels}); |
| 268 | } |
| 269 | return out; |
| 270 | } |
| 271 | |
| 272 | WeightNormConvTranspose1dWeights load_weight_norm_conv_transpose1d( |
| 273 | core::BackendWeightStore & store, |
no test coverage detected