Thanks a lot Simon, later I found out that the zeroout operation actually doesn’t compute gradient at all, so I just set both the data and gradient data of some component in the weight matrix to zero, and that seems to be working.
And now the question is, the code I am using might be too slow, is there like some built-in method I could use to increase the speed?
code:
          
            
           2

(final is the loss)
Thanks again!!