'Initialize params for LSTM including weights and biases.
The weight matrix and bias matrix are concatenated from the weights
for inputs and weights for recurrent inputs and bias.
The shape of the weights are (number of inputs + number of outputs +1 )
by (number of outputs * 4)
Arguments:
shape (Tuple): contains number of outputs and number of inputs'

def init_params(self, shape):

    (nout, nin) = (self.o_shape[0], self.i_shape[0])
    self.g_nout = (self.ngates * nout)
    Wshape = ((2 * ((nin + nout) + 1)), self.g_nout)
    doFill = False
    if (self.W is None):
        self.W = self.be.empty(Wshape, **self.get_param_attrs())
        self.dW = self.be.zeros_like(self.W)
        doFill = True
    else:
        assert (self.W.shape == Wshape)
        assert (self.dW.shape == Wshape)
    self.W_input_f = self.W[:nin].reshape((self.g_nout, nin))
    self.W_input_b = self.W[nin:(2 * nin)].reshape((self.g_nout, nin))
    self.W_recur_f = self.W[(2 * nin):((2 * nin) + nout)].reshape((self.g_nout, nout))
    self.W_recur_b = self.W[((2 * nin) + nout):((2 * nin) + (2 * nout))].reshape((self.g_nout, nout))
    self.b_f = self.W[(-2):(-1)].reshape((self.g_nout, 1))
    self.b_b = self.W[(-1):].reshape((self.g_nout, 1))
    self.dW_input_f = self.dW[:nin].reshape(self.W_input_f.shape)
    self.dW_input_b = self.dW[nin:(2 * nin)].reshape(self.W_input_b.shape)
    self.dW_recur_f = self.dW[(2 * nin):((2 * nin) + nout)].reshape(self.W_recur_f.shape)
    self.dW_recur_b = self.dW[((2 * nin) + nout):((2 * nin) + (2 * nout))].reshape(self.W_recur_b.shape)
    self.db_f = self.dW[(-2):(-1)].reshape(self.b_f.shape)
    self.db_b = self.dW[(-1):].reshape(self.b_b.shape)
    if doFill:
        gatelist = [(g * nout) for g in range(0, (self.ngates + 1))]
        for wtnm in ('W_input_f', 'W_input_b', 'W_recur_f', 'W_recur_b'):
            wtmat = getattr(self, wtnm)
            if (('W_recur' in wtnm) and (self.init_inner is not None)):
                initfunc = self.init_inner
            else:
                initfunc = self.init
            for (gb, ge) in zip(gatelist[:(-1)], gatelist[1:]):
                initfunc.fill(wtmat[gb:ge])
        self.b_f.fill(0.0)
        self.b_b.fill(0.0)
