Hi everyone, below is part of my code
def forward(self, x)
     weight = getattr(self.GRU,'weight_hh_l0')
     setattr(self.GRU,'weight_hh_l0', nn.Parameter(weight.data))

before I do this, the grad is non None. But it will be None after “setattr”. I’m sure weight_hh_l0 is leaf variable and the requires_grad = True. Maybe the “setattr” removes “weight_hh_l0” from the computational graph?
Anyone help ? Thanks