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

Function tensor_elements

src/framework/modules/wavlm_encoder.cpp:33–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31constexpr size_t kMaxPositionBiasCacheEntries = 8;
32
33int64_t tensor_elements(const std::vector<int64_t> & shape) {
34 if (shape.empty()) {
35 throw std::runtime_error("WavLM tensor shape is empty");
36 }
37 return std::accumulate(shape.begin(), shape.end(), int64_t{1}, [](int64_t lhs, int64_t rhs) {
38 if (rhs <= 0) {
39 throw std::runtime_error("WavLM tensor shape contains non-positive dimension");
40 }
41 return lhs * rhs;
42 });
43}
44
45bool has_suffix(const std::string & value, const std::string & suffix) {
46 return value.size() >= suffix.size() &&

Callers 1

load_tensor_aliasFunction · 0.70

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected