Hi Thomas, big thanks for response before.
Just want to confirm something, actually i want to implement this paper 1, the code above is just a test to produce bug, but it’s base of this forward code
    @jit.script_method
    def forward(self, x, state):
        # type: (Tensor, Tuple[Tensor, Tensor]) -> Tuple[Tensor, Tuple[Tensor, Tensor]]        
        hx, cx = state

        xh = (
            torch.mm(x, self.weight_ih.t()) + self.bias_ih + 
            torch.mm(hx, self.weight_hh.t()) + self.bias_hh
        )        
        
        i, m, o = xh.chunk(3, 1)

        m = m + (self.weight_ch_m * cx)
        o = o + (self.weight_ch_o * cx)

        i = torch.tanh(i)
        m = torch.sigmoid(m)
        o = torch.sigmoid(o)        

        # Base on Formula
        h = (1 - m) * cx + (m * i)
        c = (1 - o) * i + (o * cx)       

        return h, (h, c)    

since the h will be h + (c * 0) to make grad connected to backward, is the implementation of this code is correct for the paper 1 in term of forward and backward? or there is something wrong with my implementation?
Any response will be appreciate, Thanks.