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

Function repeat_channels

src/framework/modules/norm_modules.cpp:154–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152 const core::TensorValue & normalized,
153 const NormConfig & config,
154 const NormWeights & weights) {
155 core::TensorValue result = normalized;
156 if (config.use_weight) {
157 if (!weights.weight.has_value()) {
158 throw std::runtime_error("weight is required when NormConfig.use_weight is true");
159 }
160 core::validate_shape(*weights.weight, core::TensorShape::from_dims({config.hidden_size}), "weight");
161 const auto weight = ensure_f32(ctx, *weights.weight);
162 result = core::wrap_tensor(ggml_mul(ctx.ggml, result.tensor, weight.tensor), result.shape, GGML_TYPE_F32);
163 }
164 if (config.use_bias) {
165 if (!weights.bias.has_value()) {
166 throw std::runtime_error("bias is required when NormConfig.use_bias is true");

Callers 1

buildMethod · 0.85

Calls 6

validate_shapeFunction · 0.85
reshape_tensorFunction · 0.85
wrap_tensorFunction · 0.85
ggml_repeatFunction · 0.85
ensure_f32Function · 0.70

Tested by

no test coverage detected