avg_pixel_value is calculated from the input image without using any of the model parameters or outputs, so for backpropagation with respect to the model parameters, it is ignored.
Might I suggest a lecture on backpropagation by Andrej Karpathy 20.