src/api/native_tensor_audio.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // native_tensor_audio.cpp — restored from the QuickJS binding | ||
| 2 | // (src/js/tensor_bindings_audio.cpp): the spectral / FFT core, the complex | ||
| 3 | // helpers and STFT / iSTFT. The rest of the group's bodies live in | ||
| 4 | // native_tensor_audio_b.cpp; the registration table at the bottom of this file | ||
| 5 | // registers both halves. | ||
| 6 | // | ||
| 7 | // Complex tensors are FP32 with the bin axis interleaved [re,im,...] — an | ||
| 8 | // (R, 2*C) tensor. fft / ifft have no backward (the adjoint is the other | ||
| 9 | // transform plus a scalar); rfft / irfft and stft / istft do, because their | ||
| 10 | // adjoints carry bin weighting / window + COLA normalisation. | ||
| 11 | |||
| 12 | #include "native_tensor_audio_decl.h" | ||
| 13 | #include "api_internal.h" | ||
| 14 | #include "native_register.h" | ||
| 15 | |||
| 16 | using namespace brotensor::api; | ||
| 17 | |||
| 18 | extern "C" { | ||
| 19 | |||
| 20 | // ─── Spectral / FFT core ─────────────────────────────────────────────────── | ||
| 21 | |||
| 22 | 2 | void bro_tensor_fft(void* x, void* y) { | |
| 23 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("fft", {x, y})) return; |
| 24 | BROTENSOR_API_TRY | ||
| 25 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::fft(*toTensor(x), *toTensor(y)); |
| 26 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("fft") |
| 27 | 2 | } | |
| 28 | |||
| 29 | 2 | void bro_tensor_ifft(void* x, void* y) { | |
| 30 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("ifft", {x, y})) return; |
| 31 | BROTENSOR_API_TRY | ||
| 32 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::ifft(*toTensor(x), *toTensor(y)); |
| 33 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("ifft") |
| 34 | 2 | } | |
| 35 | |||
| 36 | 2 | void bro_tensor_rfft(void* x, void* y) { | |
| 37 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("rfft", {x, y})) return; |
| 38 | BROTENSOR_API_TRY | ||
| 39 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::rfft(*toTensor(x), *toTensor(y)); |
| 40 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("rfft") |
| 41 | 2 | } | |
| 42 | |||
| 43 | 2 | void bro_tensor_irfft(void* x, int32_t L, void* y) { | |
| 44 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("irfft", {x, y})) return; |
| 45 | BROTENSOR_API_TRY | ||
| 46 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::irfft(*toTensor(x), L, *toTensor(y)); |
| 47 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("irfft") |
| 48 | 2 | } | |
| 49 | |||
| 50 | 2 | void bro_tensor_rfftBackward(void* dY, int32_t L, void* dX) { | |
| 51 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("rfftBackward", {dY, dX})) return; |
| 52 | BROTENSOR_API_TRY | ||
| 53 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::rfft_backward(*toTensor(dY), L, *toTensor(dX)); |
| 54 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("rfftBackward") |
| 55 | 2 | } | |
| 56 | |||
| 57 | 2 | void bro_tensor_irfftBackward(void* dY, void* dX) { | |
| 58 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("irfftBackward", {dY, dX})) return; |
| 59 | BROTENSOR_API_TRY | ||
| 60 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::irfft_backward(*toTensor(dY), *toTensor(dX)); |
| 61 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("irfftBackward") |
| 62 | 2 | } | |
| 63 | |||
| 64 | 2 | void bro_tensor_complexMul(void* a, void* b, void* y) { | |
| 65 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("complexMul", {a, b, y})) return; |
| 66 | BROTENSOR_API_TRY | ||
| 67 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
2 | brotensor::complex_mul(*toTensor(a), *toTensor(b), *toTensor(y)); |
| 68 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("complexMul") |
| 69 | 2 | } | |
| 70 | |||
| 71 | 2 | void bro_tensor_complexMulBackward(void* a, void* b, void* dY, void* dA, void* dB) { | |
| 72 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("complexMulBackward", {a, b, dY, dA, dB})) return; |
| 73 | BROTENSOR_API_TRY | ||
| 74 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | brotensor::complex_mul_backward(*toTensor(a), *toTensor(b), *toTensor(dY), |
| 75 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | *toTensor(dA), *toTensor(dB)); |
| 76 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("complexMulBackward") |
| 77 | 2 | } | |
| 78 | |||
| 79 | 2 | void bro_tensor_complexAbs(void* z, void* y) { | |
| 80 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("complexAbs", {z, y})) return; |
| 81 | BROTENSOR_API_TRY | ||
| 82 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::complex_abs(*toTensor(z), *toTensor(y)); |
| 83 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("complexAbs") |
| 84 | 2 | } | |
| 85 | |||
| 86 | 2 | void bro_tensor_complexAbsBackward(void* z, void* dY, void* dZ) { | |
| 87 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("complexAbsBackward", {z, dY, dZ})) return; |
| 88 | BROTENSOR_API_TRY | ||
| 89 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
2 | brotensor::complex_abs_backward(*toTensor(z), *toTensor(dY), *toTensor(dZ)); |
| 90 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("complexAbsBackward") |
| 91 | 2 | } | |
| 92 | |||
| 93 | 2 | void bro_tensor_complexAngle(void* z, void* y) { | |
| 94 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("complexAngle", {z, y})) return; |
| 95 | BROTENSOR_API_TRY | ||
| 96 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::complex_angle(*toTensor(z), *toTensor(y)); |
| 97 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("complexAngle") |
| 98 | 2 | } | |
| 99 | |||
| 100 | 2 | void bro_tensor_complexFromPolar(void* mag, void* phase, void* y) { | |
| 101 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("complexFromPolar", {mag, phase, y})) return; |
| 102 | BROTENSOR_API_TRY | ||
| 103 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
2 | brotensor::complex_from_polar(*toTensor(mag), *toTensor(phase), *toTensor(y)); |
| 104 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("complexFromPolar") |
| 105 | 2 | } | |
| 106 | |||
| 107 | // ─── STFT / iSTFT ────────────────────────────────────────────────────────── | ||
| 108 | |||
| 109 | 4 | void bro_tensor_stft(void* signal, void* window, int32_t N, int32_t nFft, | |
| 110 | int32_t hopLength, int32_t winLength, bool center, | ||
| 111 | bool normalized, void* spec) { | ||
| 112 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (!need("stft", {signal, window, spec})) return; |
| 113 | BROTENSOR_API_TRY | ||
| 114 |
3/6✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 | brotensor::stft(*toTensor(signal), *toTensor(window), N, nFft, hopLength, |
| 115 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | winLength, center, normalized, *toTensor(spec)); |
| 116 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
4 | BROTENSOR_API_CATCH("stft") |
| 117 | 4 | } | |
| 118 | |||
| 119 | 2 | void bro_tensor_stftBackward(void* dSpec, void* window, int32_t N, int32_t signalLen, | |
| 120 | int32_t nFft, int32_t hopLength, int32_t winLength, | ||
| 121 | bool center, bool normalized, void* dSignal) { | ||
| 122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("stftBackward", {dSpec, window, dSignal})) return; |
| 123 | BROTENSOR_API_TRY | ||
| 124 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::stft_backward(*toTensor(dSpec), *toTensor(window), N, signalLen, nFft, |
| 125 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | hopLength, winLength, center, normalized, *toTensor(dSignal)); |
| 126 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("stftBackward") |
| 127 | 2 | } | |
| 128 | |||
| 129 | 4 | void bro_tensor_istft(void* spec, void* window, int32_t N, int32_t signalLen, | |
| 130 | int32_t nFft, int32_t hopLength, int32_t winLength, | ||
| 131 | bool center, bool normalized, void* signal) { | ||
| 132 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (!need("istft", {spec, window, signal})) return; |
| 133 | BROTENSOR_API_TRY | ||
| 134 |
3/6✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 | brotensor::istft(*toTensor(spec), *toTensor(window), N, signalLen, nFft, |
| 135 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | hopLength, winLength, center, normalized, *toTensor(signal)); |
| 136 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
4 | BROTENSOR_API_CATCH("istft") |
| 137 | 4 | } | |
| 138 | |||
| 139 | 2 | void bro_tensor_istftBackward(void* dSignal, void* window, int32_t N, int32_t signalLen, | |
| 140 | int32_t nFft, int32_t hopLength, int32_t winLength, | ||
| 141 | bool center, bool normalized, void* dSpec) { | ||
| 142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!need("istftBackward", {dSignal, window, dSpec})) return; |
| 143 | BROTENSOR_API_TRY | ||
| 144 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | brotensor::istft_backward(*toTensor(dSignal), *toTensor(window), N, signalLen, nFft, |
| 145 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | hopLength, winLength, center, normalized, *toTensor(dSpec)); |
| 146 |
0/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | BROTENSOR_API_CATCH("istftBackward") |
| 147 | 2 | } | |
| 148 | |||
| 149 | } // extern "C" | ||
| 150 | |||
| 151 | // ─── Registration ────────────────────────────────────────────────────────── | ||
| 152 | // | ||
| 153 | // One table for the whole audio group — the bodies declared in | ||
| 154 | // native_tensor_audio_decl.h, wherever they are defined. | ||
| 155 | |||
| 156 | namespace brotensor::api { | ||
| 157 | |||
| 158 | 3 | bool registerTensorNatives_audio(std::string* error) { | |
| 159 | using namespace brotensor::api::reg; | ||
| 160 | |||
| 161 | // Spectral / FFT core + the complex helpers. | ||
| 162 | 3 | bool ok = | |
| 163 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.fft", p(&bro_tensor_fft), "void", {kTensorCls, kTensorCls}, error) && |
| 164 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.ifft", p(&bro_tensor_ifft), "void", {kTensorCls, kTensorCls}, error) && |
| 165 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.rfft", p(&bro_tensor_rfft), "void", {kTensorCls, kTensorCls}, error) && |
| 166 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.irfft", p(&bro_tensor_irfft), "void", {kTensorCls, "i32", kTensorCls}, error) && |
| 167 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.rfftBackward", p(&bro_tensor_rfftBackward), "void", {kTensorCls, "i32", kTensorCls}, error) && |
| 168 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.irfftBackward", p(&bro_tensor_irfftBackward), "void", {kTensorCls, kTensorCls}, error) && |
| 169 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.complexMul", p(&bro_tensor_complexMul), "void", {kTensorCls, kTensorCls, kTensorCls}, error) && |
| 170 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.complexMulBackward", p(&bro_tensor_complexMulBackward), "void", {kTensorCls, kTensorCls, kTensorCls, kTensorCls, kTensorCls}, error) && |
| 171 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.complexAbs", p(&bro_tensor_complexAbs), "void", {kTensorCls, kTensorCls}, error) && |
| 172 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.complexAbsBackward", p(&bro_tensor_complexAbsBackward), "void", {kTensorCls, kTensorCls, kTensorCls}, error) && |
| 173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.complexAngle", p(&bro_tensor_complexAngle), "void", {kTensorCls, kTensorCls}, error) && |
| 174 | 3 | fn("__bro_native.tensor.complexFromPolar", p(&bro_tensor_complexFromPolar), "void", {kTensorCls, kTensorCls, kTensorCls}, error); | |
| 175 | |||
| 176 | // STFT / iSTFT. | ||
| 177 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | ok = ok && |
| 178 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.stft", p(&bro_tensor_stft), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "bool", "bool", kTensorCls}, error) && |
| 179 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.stftBackward", p(&bro_tensor_stftBackward), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "bool", "bool", kTensorCls}, error) && |
| 180 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.istft", p(&bro_tensor_istft), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "bool", "bool", kTensorCls}, error) && |
| 181 | 3 | fn("__bro_native.tensor.istftBackward", p(&bro_tensor_istftBackward), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "bool", "bool", kTensorCls}, error); | |
| 182 | |||
| 183 | // 1D padding + the conv1d family (native_tensor_audio_b.cpp). | ||
| 184 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | ok = ok && |
| 185 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.pad1dForward", p(&bro_tensor_pad1dForward), "void", {kTensorCls, "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 186 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.pad1dBackward", p(&bro_tensor_pad1dBackward), "void", {kTensorCls, "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 187 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.conv1d", p(&bro_tensor_conv1d), "void", {kTensorCls, kTensorCls, kDyn, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 188 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.conv1dBackwardInput", p(&bro_tensor_conv1dBackwardInput), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 189 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.conv1dBackwardWeight", p(&bro_tensor_conv1dBackwardWeight), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 190 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.conv1dBackwardBias", p(&bro_tensor_conv1dBackwardBias), "void", {kTensorCls, "i32", "i32", "i32", kTensorCls}, error) && |
| 191 | 3 | fn("__bro_native.tensor.conv1dInt8wFp16", p(&bro_tensor_conv1dInt8wFp16), "void", {kTensorCls, kTensorCls, kTensorCls, kDyn, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error); | |
| 192 | |||
| 193 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | ok = ok && |
| 194 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.convTranspose1dForward", p(&bro_tensor_convTranspose1dForward), "void", {kTensorCls, kTensorCls, kDyn, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 195 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.convTranspose1dBackwardInput", p(&bro_tensor_convTranspose1dBackwardInput), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 196 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.convTranspose1dBackwardWeight", p(&bro_tensor_convTranspose1dBackwardWeight), "void", {kTensorCls, kTensorCls, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 197 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.convTranspose1dBackwardBias", p(&bro_tensor_convTranspose1dBackwardBias), "void", {kTensorCls, "i32", "i32", "i32", kTensorCls}, error) && |
| 198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.causalConv1d", p(&bro_tensor_causalConv1d), "void", {kTensorCls, kTensorCls, kDyn, "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", kTensorCls, kTensorCls}, error) && |
| 199 | 3 | fn("__bro_native.tensor.causalConv1dUpdate", p(&bro_tensor_causalConv1dUpdate), "void", {kTensorCls, kTensorCls, kDyn, "i32", "i32", "i32", "i32", "i32", kTensorCls, kTensorCls}, error); | |
| 200 | |||
| 201 | // Vocoder / codec activations. | ||
| 202 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | ok = ok && |
| 203 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.snakeForward", p(&bro_tensor_snakeForward), "void", {kTensorCls, kTensorCls, kDyn, "i32", "i32", "i32", kTensorCls}, error) && |
| 204 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.snakeBackward", p(&bro_tensor_snakeBackward), "void", {kTensorCls, kTensorCls, kDyn, kTensorCls, "i32", "i32", "i32", kTensorCls, kTensorCls, kDyn}, error) && |
| 205 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.eluForward", p(&bro_tensor_eluForward), "void", {kTensorCls, "f64", kTensorCls}, error) && |
| 206 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.eluBackward", p(&bro_tensor_eluBackward), "void", {kTensorCls, kTensorCls, "f64", kTensorCls}, error) && |
| 207 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.leakyReluForward", p(&bro_tensor_leakyReluForward), "void", {kTensorCls, "f64", kTensorCls}, error) && |
| 208 | 3 | fn("__bro_native.tensor.leakyReluBackward", p(&bro_tensor_leakyReluBackward), "void", {kTensorCls, kTensorCls, "f64", kTensorCls}, error); | |
| 209 | |||
| 210 | // Codec quantization + 1D resampling. | ||
| 211 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | ok = ok && |
| 212 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.vqEncodeForward", p(&bro_tensor_vqEncodeForward), "void", {kTensorCls, kTensorCls, kTensorCls, kTensorCls}, error) && |
| 213 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.vqEncodeBackward", p(&bro_tensor_vqEncodeBackward), "void", {kTensorCls, kTensorCls}, error) && |
| 214 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.fsqQuantizeForward", p(&bro_tensor_fsqQuantizeForward), "void", {kTensorCls, kTensorCls, kTensorCls, kTensorCls}, error) && |
| 215 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.fsqQuantizeBackward", p(&bro_tensor_fsqQuantizeBackward), "void", {kTensorCls, kTensorCls}, error) && |
| 216 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.resample1dForward", p(&bro_tensor_resample1dForward), "void", {kTensorCls, "i32", "i32", "i32", "i32", "i32", kTensorCls}, error) && |
| 217 | 3 | fn("__bro_native.tensor.resample1dBackward", p(&bro_tensor_resample1dBackward), "void", {kTensorCls, "i32", "i32", "i32", "i32", "i32", kTensorCls}, error); | |
| 218 | |||
| 219 | // log / exp / round elementwise + the autoregressive logit sampler. | ||
| 220 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | ok = ok && |
| 221 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.logForward", p(&bro_tensor_logForward), "void", {kTensorCls, kTensorCls}, error) && |
| 222 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.logBackward", p(&bro_tensor_logBackward), "void", {kTensorCls, kTensorCls, kTensorCls}, error) && |
| 223 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.expForward", p(&bro_tensor_expForward), "void", {kTensorCls, kTensorCls}, error) && |
| 224 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.expBackward", p(&bro_tensor_expBackward), "void", {kTensorCls, kTensorCls, kTensorCls}, error) && |
| 225 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.roundForward", p(&bro_tensor_roundForward), "void", {kTensorCls, kTensorCls}, error) && |
| 226 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | fn("__bro_native.tensor.roundBackward", p(&bro_tensor_roundBackward), "void", {kTensorCls, kTensorCls}, error) && |
| 227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | fn("__bro_native.tensor.sampleLogits", p(&bro_tensor_sampleLogits), "void", {kTensorCls, "f64", "i32", "f64", kDyn, kDyn, kTensorCls}, error) && |
| 228 | 3 | fn("__bro_native.tensor.sampleLogitsInto", p(&bro_tensor_sampleLogitsInto), "void", {kTensorCls, "f64", "i32", "f64", kDyn, kTensorCls, kTensorCls, kTensorCls}, error); | |
| 229 | |||
| 230 | 3 | return ok; | |
| 231 | } | ||
| 232 | |||
| 233 | } // namespace brotensor::api | ||
| 234 |