r"""Hybrid forward computation for Long-Short Term Memory Projected network cell
        with cell clip and projection clip.

        Parameters
        ----------
        inputs : input tensor with shape `(batch_size, input_size)`.
        states : a list of two initial recurrent state tensors, with shape
            `(batch_size, projection_size)` and `(batch_size, hidden_size)` respectively.

        Returns
        --------
        out : output tensor with shape `(batch_size, num_hidden)`.
        next_states : a list of two output recurrent state tensors. Each has
            the same shape as `states`.

def hybrid_forward(self, F, inputs, states, i2h_weight,
                       h2h_weight, h2r_weight, i2h_bias, h2h_bias):
        r"""Hybrid forward computation for Long-Short Term Memory Projected network cell
        with cell clip and projection clip.

        Parameters
        ----------
        inputs : input tensor with shape `(batch_size, input_size)`.
        states : a list of two initial recurrent state tensors, with shape
            `(batch_size, projection_size)` and `(batch_size, hidden_size)` respectively.

        Returns
        --------
        out : output tensor with shape `(batch_size, num_hidden)`.
        next_states : a list of two output recurrent state tensors. Each has
            the same shape as `states`.
        """
        prefix = 't%d_'%self._counter
        i2h = F.FullyConnected(data=inputs, weight=i2h_weight, bias=i2h_bias,
                               num_hidden=self._hidden_size*4, name=prefix+'i2h')
        h2h = F.FullyConnected(data=states[0], weight=h2h_weight, bias=h2h_bias,
                               num_hidden=self._hidden_size*4, name=prefix+'h2h')
        gates = i2h + h2h
        slice_gates = F.SliceChannel(gates, num_outputs=4, name=prefix+'slice')
        in_gate = F.Activation(slice_gates[0], act_type='sigmoid', name=prefix+'i')
        forget_gate = F.Activation(slice_gates[1], act_type='sigmoid', name=prefix+'f')
        in_transform = F.Activation(slice_gates[2], act_type='tanh', name=prefix+'c')
        out_gate = F.Activation(slice_gates[3], act_type='sigmoid', name=prefix+'o')
        next_c = F._internal._plus(forget_gate * states[1], in_gate * in_transform,
                                   name=prefix+'state')
        if self._cell_clip is not None:
            next_c = next_c.clip(-self._cell_clip, self._cell_clip)
        hidden = F._internal._mul(out_gate, F.Activation(next_c, act_type='tanh'),
                                  name=prefix+'hidden')
        next_r = F.FullyConnected(data=hidden, num_hidden=self._projection_size,
                                  weight=h2r_weight, no_bias=True, name=prefix+'out')
        if self._projection_clip is not None:
            next_r = next_r.clip(-self._projection_clip, self._projection_clip)

        return next_r, [next_r, next_c]