| 1276 | int stride, |
| 1277 | StreamingConvTranspose1dState & state) { |
| 1278 | auto output = runtime.run(input); |
| 1279 | const int64_t raw_frames = frames == 0 ? 0 : (frames - 1) * stride + kernel_size; |
| 1280 | if (state.partial_frames > 0) { |
| 1281 | for (int64_t channel = 0; channel < channels; ++channel) { |
| 1282 | for (int64_t t = 0; t < state.partial_frames; ++t) { |
| 1283 | output[static_cast<size_t>(channel * raw_frames + t)] += |
| 1284 | state.partial[static_cast<size_t>(channel * state.partial_frames + t)]; |
| 1285 | } |
| 1286 | } |
| 1287 | state.partial = tail_bct(output, channels, raw_frames, state.partial_frames); |
| 1288 | output = head_bct(output, channels, raw_frames, raw_frames - state.partial_frames); |
| 1289 | } |
| 1290 | return output; |
| 1291 | } |
| 1292 | |
| 1293 | } // namespace |
| 1294 | |
| 1295 | struct MimiDecoder::RuntimeCache { |
| 1296 | const models::pocket_tts::PocketTTSAssets * manifest = nullptr; |
| 1297 | ggml_backend_t backend = nullptr; |
| 1298 | int threads = 0; |
| 1299 | size_t conv_graph_context_bytes = 0; |
| 1300 | size_t transformer_graph_context_bytes = 0; |
| 1301 | size_t tail_graph_context_bytes = 0; |
| 1302 | |
| 1303 | std::unique_ptr<DepthwiseConvTranspose1dRuntime> encoder_rate_upsample_runtime; |
| 1304 | int64_t encoder_rate_upsample_steps = -1; |
| 1305 | std::unique_ptr<Conv1dRuntime> quantizer_runtime; |
| 1306 | int64_t quantizer_steps = -1; |
| 1307 | std::unique_ptr<MimiTransformerRuntime> transformer_runtime; |
| 1308 | int64_t transformer_frames = -1; |
| 1309 | std::unique_ptr<Conv1dRuntime> input_projection_runtime; |
| 1310 | int64_t input_projection_frames = -1; |
| 1311 | std::unique_ptr<ConvTranspose1dRuntime> stage0_upsample_runtime; |
| 1312 | int64_t stage0_upsample_frames = -1; |
| 1313 | std::unique_ptr<Conv1dRuntime> stage0_conv1_runtime; |
| 1314 | std::unique_ptr<Conv1dRuntime> stage0_conv2_runtime; |
| 1315 | std::unique_ptr<ConvTranspose1dRuntime> stage1_upsample_runtime; |
| 1316 | int64_t stage1_upsample_frames = -1; |
| 1317 | std::unique_ptr<Conv1dRuntime> stage1_conv1_runtime; |
| 1318 | std::unique_ptr<Conv1dRuntime> stage1_conv2_runtime; |
| 1319 | std::unique_ptr<ConvTranspose1dRuntime> stage2_upsample_runtime; |
| 1320 | int64_t stage2_upsample_frames = -1; |
| 1321 | std::unique_ptr<Conv1dRuntime> stage2_conv1_runtime; |
| 1322 | std::unique_ptr<Conv1dRuntime> stage2_conv2_runtime; |
| 1323 | std::unique_ptr<Conv1dRuntime> output_projection_runtime; |
| 1324 | int64_t output_projection_frames = -1; |
| 1325 | std::array<int64_t, 3> resblock_conv1_frames = {-1, -1, -1}; |
| 1326 | std::array<int64_t, 3> resblock_conv2_frames = {-1, -1, -1}; |
| 1327 | |
| 1328 | std::unique_ptr<Conv1dRuntime> full_quantizer_runtime; |
| 1329 | int64_t full_quantizer_steps = -1; |
| 1330 | std::unique_ptr<DepthwiseConvTranspose1dRuntime> full_encoder_rate_upsample_runtime; |
| 1331 | int64_t full_encoder_steps = -1; |
| 1332 | std::unique_ptr<MimiTransformerRuntime> full_transformer_runtime; |
| 1333 | int64_t full_transformer_frames = -1; |
| 1334 | std::unique_ptr<MimiFullDecoderRuntime> full_decoder_runtime; |
| 1335 | int64_t full_decoder_steps = -1; |
no test coverage detected