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

Function validate_shape

src/framework/core/module.cpp:212–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void validate_shape(const TensorValue & value, const TensorShape & expected, const char * name) {
213 if (!value.valid()) {
214 throw std::runtime_error(name_or_default(name) + " is invalid");
215 }
216 if (value.shape.rank != expected.rank) {
217 throw std::runtime_error(name_or_default(name) + " rank mismatch: expected " + expected.to_string() +
218 ", got " + value.shape.to_string());
219 }
220 for (size_t i = 0; i < expected.rank; ++i) {
221 if (value.shape.dims[i] != expected.dims[i]) {
222 throw std::runtime_error(name_or_default(name) + " shape mismatch: expected " + expected.to_string() +
223 ", got " + value.shape.to_string());
224 }
225 }
226}
227
228void validate_last_dim(const TensorValue & value, int64_t expected, const char * name) {
229 if (!value.valid()) {

Callers 15

buildMethod · 0.85
build_time_mask_4dFunction · 0.85
variance_rms_normFunction · 0.85
buildMethod · 0.85
buildMethod · 0.85
validate_weight_shapesFunction · 0.85
build_lstm_sequenceFunction · 0.85
buildMethod · 0.85
apply_affineFunction · 0.85
repeat_channelsFunction · 0.85
buildMethod · 0.85

Calls 3

name_or_defaultFunction · 0.85
validMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected