| 31 | constexpr size_t kMaxPositionBiasCacheEntries = 8; |
| 32 | |
| 33 | int64_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 | |
| 45 | bool has_suffix(const std::string & value, const std::string & suffix) { |
| 46 | return value.size() >= suffix.size() && |
no test coverage detected