MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / load_weight_norm_conv1d

Function load_weight_norm_conv1d

src/models/ace_step/vae_decoder.cpp:242–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242WeightNormConv1dWeights 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
272WeightNormConvTranspose1dWeights load_weight_norm_conv_transpose1d(
273 core::BackendWeightStore & store,

Callers 3

load_residual_unitFunction · 0.70
load_vae_decoder_weightsFunction · 0.70
load_vae_encoder_weightsFunction · 0.70

Calls 5

make_from_f32Method · 0.80
load_f32_tensorMethod · 0.80
apply_weight_normFunction · 0.70
require_f32Method · 0.45

Tested by

no test coverage detected