Implement Local Response Normalization (LRN)
Implement local_response_normalization(x, n=5, k=2.0, alpha=1e-4, beta=0.75) for an input x of shape (N, C, H, W), normalising every activation by its neighbours along the channel axis.
Let h=⌊n/2⌋. For channel i the window is the set of channels j with max(0,i−h)≤j≤min(C−1,i+h) (clipped at the edges, so it is shorter near the first and last channel):
bc,i,x,y=(k+α∑j=max(0,i−h)min(C−1,i+h)ac,j,x,y2)βac,i,x,y
alpha multiplies the raw sum of squares (no division by n).
- Return an array of the same shape as
x, rounded to 4 decimals.