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

Function num_elements

src/models/miocodec/weights.cpp:21–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21int64_t num_elements(const std::vector<int64_t> & shape) {
22 if (shape.empty() || shape.size() > engine::core::kMaxTensorRank) {
23 throw std::runtime_error("MioCodec weight tensor rank must be between 1 and 4");
24 }
25 int64_t count = 1;
26 for (const int64_t dim : shape) {
27 if (dim <= 0) {
28 throw std::runtime_error("MioCodec weight tensor dimensions must be positive");
29 }
30 count *= dim;
31 }
32 return count;
33}
34
35engine::core::TensorShape shape_from_vector(const std::vector<int64_t> & shape) {
36 switch (shape.size()) {

Callers 1

load_miocodec_weightsFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected