Whether to update all the variables in my models when i implement the backward algorithm

I have built a DMCNN model to do event extraction by Pytorch. But I did not show the statement whether the variable needs a gradient. Whether to update all the variables in my models when i implement the backward algorithm. is it very low efficient?

Hey can you share the code of the DMCNN implemented?