I was observing gradients when I noticed that the gradient of subtracting one's axis' mean is zero. I think this is very counter-intuitive because gradient = 0 normally means the function is constant. Can anyone explain intuitively why the gradient here is zero?
import tensorflow as tf
o1 = tf.random.normal((3, 3, 3, 3))
with tf.GradientTape() as tape:
tape.watch(o1)
o2 = o1-tf.reduce_mean(o1, 1, keepdims=True)
d = tape.gradient(o2, o1)
tf.print(tf.reduce_max(tf.abs(d)))
outputs me 0