| 24 | constexpr int64_t kBigVganActivationKernel = 12; |
| 25 | |
| 26 | int64_t tensor_elements(const std::vector<int64_t> & shape) { |
| 27 | if (shape.empty()) { |
| 28 | throw std::runtime_error("BigVGAN tensor shape is empty"); |
| 29 | } |
| 30 | return std::accumulate(shape.begin(), shape.end(), int64_t{1}, [](int64_t lhs, int64_t rhs) { |
| 31 | if (rhs <= 0) { |
| 32 | throw std::runtime_error("BigVGAN tensor shape contains non-positive dimension"); |
| 33 | } |
| 34 | return lhs * rhs; |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | void validate_config(const BigVganVocoderConfig & config) { |
| 39 | if (config.sampling_rate <= 0 || config.num_mels <= 0 || config.n_fft <= 0 || |
no test coverage detected