Figure REF  depicts the different steps involved in executing blocked local self-attention for an image with height \(H=4\) , width \(W=4\) ,
and \(c\)  channels with stride 1.
Blocking chops up the image into a \(\frac{H}{b}, \frac{W}{b}\)  tensor of non-overlapping \((b, b)\)  blocks.
Each block behaves as a group of query pixels and a haloing operation combines a band of \(h\)  pixels around them (with padding at boundaries) to obtain the corresponding shared neighborhood block of shape \((\frac{H}{b}, \frac{W}{b}, b+2h, b+2h, c)\)  from which the keys and values are computed.
\(\frac{H}{b} \times \frac{W}{b}\)  attention operations then run in parallel for each of the query blocks and their corresponding neighborhoods, illustrated with different colors in Figure REF .
SASA [1]} used the same blocking strategyCode for both SASA and HaloNet will be made available, along with the checkpoints for HaloNet, setting \(h=\lfloor \frac{k}{2} \rfloor \)  and uses attention masks to emulate pixel-centered neighborhood windows of size \(k \times k\) . Our approach
For example, to achieve a \(7 \times 7\)  pixel centered window, [1]} set \(h=3\) .
The use of attention masks gives the operation translational equivariance, since each pixel only looks at a square window around it.
