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

Function validate_weight_shape

src/framework/modules/linear_module.cpp:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void validate_weight_shape(const LinearConfig & config, const LinearWeights & weights) {
38 core::validate_shape(
39 weights.weight,
40 core::TensorShape::from_dims({config.out_features, config.in_features}),
41 "weight");
42
43 if (!config.use_bias) {
44 return;
45 }
46
47 if (!weights.bias.has_value()) {
48 throw std::runtime_error("bias is required when LinearConfig.use_bias is true");
49 }
50
51 core::validate_shape(
52 *weights.bias,
53 core::TensorShape::from_dims({config.out_features}),
54 "bias");
55}
56
57} // namespace
58

Callers 1

buildMethod · 0.85

Calls 1

validate_shapeFunction · 0.85

Tested by

no test coverage detected