How to only update part of weights?

For example, I have a 3*3 filter, and I want to fix some weights like (0,0), (2,2) in this filter during the training process. That means I only want to update part of weights in this filter. How to implement it?

You can zero out the gradients for the parts you want to freeze after each backward.

weight decay and momentum will still change the weight?