Subclassed Layer + keras.ops 만 써서 attention 직접 짜. __init__ 에 num_heads / key_dim, build 에 q/k/v 의 weight, call 에 q/k/v 계산 → softmax(qk^T/sqrt(d)) → ·v → 최종 projection. 약 80 줄로 multi-head attention 완성.
이 layer 는 portable — keras.ops 만 써서 세 backend 다 동작. 본인이 짠 attention 의 weight 가 model.fit() 으로 학습되는 거 보면 *내 손으로* attention 만든 느낌이 와.