HI.
I want to freeze my GRU after a certain amount of training. I have a ‘model’ Module object which has a gru in it. My code looks like this:
def freeze_encoding(self, do_freeze=True):
    self.model.gru.weight_ih.requires_grad = not do_freeze
    self.model.gru.weight_hh.requires_grad = not do_freeze
    if self.model.gru.bias == True:
        self.model.gru.bias_ih.requires_grad = not do_freeze
        self.model.gru.bias_hh.requires_grad = not do_freeze
    print('freeze encoding')
    pass

This code throws an error the weight_ih doesn’t exist. What would be the suggested way to do this right? Thanks.