The self-attention mechanism can be written as a kernel integration [1]}, [2]}, [3]}. For the input tensor \(X\)  we denote the \((n,m)\) -th token as \(x_{n,m} \in \mathbb {R}^d\) . For notation convenience, we index the token sequence as \(X[s] := X[n_s,m_s]\)  for some \(s,t \in [hw]\) . Define also \(N:=hw\)  as the sequence length. The self-attention mixing is then defined as follows:
