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

Function ensure_positive_dims

src/framework/core/module.cpp:19–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace {
18
19void ensure_positive_dims(const TensorShape & shape) {
20 if (shape.rank == 0 || shape.rank > kMaxTensorRank) {
21 throw std::runtime_error("Tensor rank must be between 1 and 4");
22 }
23
24 for (size_t i = 0; i < shape.rank; ++i) {
25 if (shape.dims[i] <= 0) {
26 throw std::runtime_error("Tensor dimensions must be positive");
27 }
28 }
29}
30
31std::string name_or_default(const char * name) {
32 return name == nullptr ? std::string("tensor") : std::string(name);

Callers 4

from_dimsMethod · 0.85
with_last_dimMethod · 0.85
make_tensorFunction · 0.85
wrap_tensorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected