Implement the attention core of gpt-oss: causal grouped-query attention with an optional sliding window and a learned sink logit per query head.
sink_attention(Q, K, V, sinks, sliding_window=0):
Q has shape (T, Hq, d); K and V have shape (T, Hkv, d) with a multiple of . Query head uses key/value head , so consecutive query heads share a key/value head.sinks has shape (Hq,): one real number per query head.sliding_window , also , so the query sees itself and the positions before it. sliding_window = 0 means no window.(T, Hq * d): the heads of each position concatenated in head order.Work in float64 and keep the softmax numerically stable.