human
Complete this python program:
def checkBatchGradient():
assistant
#Here is the Python code you requested.

    """check that the batch gradient is correct
    """
    (n, b, d) = (5, 3, 4)
    input_size = 10
    WLSTM = LSTM.init(input_size, d)
    X = np.random.randn(n, b, input_size)
    h0 = np.random.randn(b, d)
    c0 = np.random.randn(b, d)
    (H, Ct, Ht, cache) = LSTM.forward(X, WLSTM, c0, h0)
    wrand = np.random.randn(*H.shape)
    dH = wrand
    (dX, dWLSTM, dc0, dh0) = LSTM.backward(dH, cache)
    def fwd():
        (h, _, _, _) = LSTM.forward(X, WLSTM, c0, h0)
        return np.sum((h * wrand))
    delta = 1e-05
    rel_error_thr_warning = 0.01
    rel_error_thr_error = 1
    tocheck = [X, WLSTM, c0, h0]
    grads_analytic = [dX, dWLSTM, dc0, dh0]
    names = ['X', 'WLSTM', 'c0', 'h0']
    for j in range(len(tocheck)):
        mat = tocheck[j]
        dmat = grads_analytic[j]
        name = names[j]
        for i in range(mat.size):
            old_val = mat.flat[i]
            mat.flat[i] = (old_val + delta)
            loss0 = fwd()
            mat.flat[i] = (old_val - delta)
            loss1 = fwd()
            mat.flat[i] = old_val
            grad_analytic = dmat.flat[i]
            grad_numerical = ((loss0 - loss1) / float((2 * delta)))
            if ((grad_numerical == 0) and (grad_analytic == 0)):
                rel_error = 0
                status = 'OK'
            elif ((abs(grad_numerical) < 1e-07) and (abs(grad_analytic) < 1e-07)):
                rel_error = 0
                status = 'VAL    SMALL    WARNING'
            else:
                rel_error = (abs((grad_analytic - grad_numerical)) / abs(float((grad_numerical + grad_analytic))))
                status = 'OK'
                if (rel_error > rel_error_thr_warning):
                    status = 'WARNING'
                if (rel_error > rel_error_thr_error):
                    status = '!!!!!    NOTOK'
            neon_logger.display(('%s    checking    param    %s    index    %s    (val    =    %+8f),    analytic    =    %+8f,' + ('numerical    =    %+8f,    relative    error    =    %+8f' % (status, name, repr(np.unravel_index(i, mat.shape)), old_val, grad_analytic,...