human
Complete the below
def ctc_batch_cost(y_true, y_pred, input_length, label_length):

    ''''Runs CTC loss algorithm on each batch element.
    # Arguments
    y_true: tensor (samples, max_string_length) containing the truth labels
    y_pred: tensor (samples, time_steps, num_categories) containing the prediction,
    or output of the softmax
    input_length: tensor (samples,1) containing the sequence length for
    each batch item in y_pred
    label_length: tensor (samples,1) containing the sequence length for
    each batch item in y_true
    # Returns
    Tensor with shape (samples,1) containing the
    CTC loss of each element'
    '''

Can you provide a the Python program you requested?
assistant
#Here is the Python program you requested.
    def ctc_step(y_true_step, y_pred_step, input_length_step, label_length_step):
        y_pred_step = y_pred_step[0:input_length_step[0]]
        y_true_step = y_true_step[0:label_length_step[0]]
        return ctc_cost(y_pred_step, y_true_step)
    (ret, _) = theano.scan(fn=ctc_step, outputs_info=None, sequences=[y_true, y_pred, input_length, label_length])
    ret = ret.dimshuffle('x', 0)
    return ret