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

Function apply_affine

src/framework/modules/norm_modules.cpp:93–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91};
92
93const core::ModulePortSpec kBatchNorm1dEvalInputs[] = {
94 {"input", core::PortKind::Activation, false},
95 {"scale", core::PortKind::Parameter, false},
96 {"bias", core::PortKind::Parameter, true},
97};
98
99const core::ModuleSchema kBatchNorm1dEvalSchema = {
100 "BatchNorm1dEval",
101 "nn.normalization",
102 kBatchNorm1dEvalInputs,
103 3,
104 kNormOutputs,
105 1,
106 "Applies precomputed 1D batch-normalization eval scale and bias to channel-first tensors.",
107};
108
109core::TensorValue ensure_f32(
110 core::ModuleBuildContext & ctx,
111 const core::TensorValue & value) {
112 if (value.type == GGML_TYPE_F32) {
113 return value;
114 }
115 return core::wrap_tensor(ggml_cast(ctx.ggml, value.tensor, GGML_TYPE_F32), value.shape, GGML_TYPE_F32);
116}
117
118bool same_shape(const core::TensorShape & lhs, const core::TensorShape & rhs) {
119 if (lhs.rank != rhs.rank) {

Callers 1

build_normFunction · 0.85

Calls 5

validate_shapeFunction · 0.85
wrap_tensorFunction · 0.85
ggml_mulFunction · 0.85
ggml_addFunction · 0.85
ensure_f32Function · 0.70

Tested by

no test coverage detected