Hi,
Since these elements don’t contribute to the final output, their gradient is 0.
Note that in a neural net, usually the weights are used to get values for all the outputs or you use a softmax layer that couples all the outputs together. And that will make all the weights of your net to be updated.