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

Function tensor_elements

src/framework/modules/bigvgan_vocoder.cpp:26–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24constexpr int64_t kBigVganActivationKernel = 12;
25
26int64_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
38void validate_config(const BigVganVocoderConfig & config) {
39 if (config.sampling_rate <= 0 || config.num_mels <= 0 || config.n_fft <= 0 ||

Callers 1

load_from_safetensorsMethod · 0.70

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected