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

Function bind_snake_beta

src/models/miocodec/weights.cpp:417–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417MioCodecSnakeBetaWeights bind_snake_beta(
418 MioCodecWeights & weights,
419 const engine::assets::TensorSource & source,
420 const std::string & prefix,
421 int64_t channels) {
422 std::vector<float> alpha(static_cast<size_t>(channels), 0.0F);
423 std::vector<float> inv_beta(static_cast<size_t>(channels), 0.0F);
424 const auto alpha_source = source.require_f32(prefix + ".alpha", {channels});
425 const auto beta_source = source.require_f32(prefix + ".beta", {channels});
426 for (int64_t i = 0; i < channels; ++i) {
427 alpha[static_cast<size_t>(i)] = std::exp(alpha_source[static_cast<size_t>(i)]);
428 inv_beta[static_cast<size_t>(i)] = 1.0F / (std::exp(beta_source[static_cast<size_t>(i)]) + 1.0e-9F);
429 }
430 return {
431 weights.store->make_f32(engine::core::TensorShape::from_dims({channels}), std::move(alpha)),
432 weights.store->make_f32(engine::core::TensorShape::from_dims({channels}), std::move(inv_beta)),
433 };
434}
435
436MioCodecResNetBlockWeights bind_resnet_block(
437 const MioCodecWeights & weights,

Callers 1

bind_upsamplerFunction · 0.85

Calls 2

require_f32Method · 0.45
make_f32Method · 0.45

Tested by

no test coverage detected