Great. Thanks for your help! I indeed want to keep the state since the context of this cell is an RNN. Do you know why this isn’t an issue when replacing res = self.state + x with res = self.state + self.weight (i.e, the comment in the snippet)?