def METHOD_NAME(self, x, h_prev, x_mask, h_mask):
    s0 = self._compute_init_state(x, h_prev, x_mask, h_mask)
    states = [s0]
    for i, (name, pred) in enumerate(self.genotype.recurrent):
        s_prev = states[pred]
        if self.training:
            ch = (s_prev * h_mask).mm(self._Ws[i])
        else:
            ch = s_prev.mm(self._Ws[i])
        c, h = torch.split(ch, self.nhid, dim=-1)
        c = c.sigmoid()
        fn = self._get_activation(name)
        h = fn(h)
        s = s_prev + c * (h - s_prev)
        states += [s]
    output = torch.mean(torch.stack([states[i] for i in self.genotype.concat], -1), -1)
    return output