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

Function load_linear

src/framework/modules/hift_vocoder.cpp:131–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131LinearWeights 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
156SnakeWeights load_snake(
157 core::BackendWeightStore & store,

Callers 1

load_from_safetensorsMethod · 0.70

Calls 2

make_from_f32Method · 0.80
require_f32Method · 0.45

Tested by

no test coverage detected