#pragma once
#include "ggml.h"
#include <vector>
struct ggml_context;
struct ggml_tensor;
struct ggml_cgraph;
namespace transcribe::moonshine_streaming {
struct MoonshineStreamingHParams;
struct MoonshineStreamingWeights;
struct EncoderDumps {
ggml_tensor * audio_in = nullptr;
ggml_tensor * cmvn_out = nullptr;
ggml_tensor * comp_out = nullptr;
ggml_tensor * linear_out = nullptr;
ggml_tensor * conv1_out = nullptr;
ggml_tensor * conv2_out = nullptr;
std::vector<ggml_tensor *> block_outs;
ggml_tensor * final_out = nullptr;
};
struct EncoderBuild {
ggml_tensor * audio_in = nullptr;
std::vector<ggml_tensor *> per_layer_masks;
ggml_tensor * out = nullptr;
EncoderDumps dumps{};
ggml_cgraph * graph = nullptr;
int T_enc = 0;
};
int encoder_t_enc(const MoonshineStreamingHParams & hp, int n_samples);
bool dump_block_index(int i, int n_layers);
EncoderBuild build_encoder_graph(ggml_context * compute_ctx,
const MoonshineStreamingWeights & weights,
const MoonshineStreamingHParams & hp,
int n_samples,
bool use_flash = false);
void build_sliding_window_mask(int T_enc, int left_window, int right_window, float * out_mask);
}