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

Function load_resblock

src/framework/modules/hift_vocoder.cpp:175–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175ResBlockWeights load_resblock(
176 core::BackendWeightStore & store,
177 const assets::TensorSource & source,
178 const std::string & prefix,
179 int64_t channels,
180 int64_t kernel,
181 const std::vector<int64_t> & dilations,
182 assets::TensorStorageType storage_type) {
183 ResBlockWeights block;
184 block.convs1.reserve(dilations.size());
185 block.convs2.reserve(dilations.size());
186 block.activations1.reserve(dilations.size());
187 block.activations2.reserve(dilations.size());
188 for (size_t index = 0; index < dilations.size(); ++index) {
189 const int64_t dilation = dilations[index];
190 block.convs1.push_back(load_conv1d(
191 store,
192 source,
193 prefix + ".convs1." + std::to_string(index),
194 channels,
195 channels,
196 kernel,
197 1,
198 (kernel * dilation - dilation) / 2,
199 dilation,
200 true,
201 storage_type));
202 block.convs2.push_back(load_conv1d(
203 store,
204 source,
205 prefix + ".convs2." + std::to_string(index),
206 channels,
207 channels,
208 kernel,
209 1,
210 (kernel - 1) / 2,
211 1,
212 true,
213 storage_type));
214 block.activations1.push_back(load_snake(
215 store,
216 source,
217 prefix + ".activations1." + std::to_string(index) + ".alpha",
218 channels,
219 storage_type));
220 block.activations2.push_back(load_snake(
221 store,
222 source,
223 prefix + ".activations2." + std::to_string(index) + ".alpha",
224 channels,
225 storage_type));
226 }
227 return block;
228}
229
230ggml_tensor * named(ggml_tensor * tensor, const char * name) {
231 return ggml_set_name(tensor, name);

Callers 1

load_from_safetensorsMethod · 0.70

Calls 4

load_conv1dFunction · 0.70
load_snakeFunction · 0.70
to_stringFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected