def run_predictions(
    estimator: "CLASSIFIER_NEURALNETWORK_TYPE",
    imgs: list[np.ndarray],
    target: int,
    batch_size: int,
    err_rate: bool = True,
) -> float:
    """
    Run model predictions over batch of input.

    :param estimator: The model.
    :param imgs: Batch of images with different transforms.
    :param target: Target label.
    :param batch_size: Size of batches to process.
    :param err_rate: Whether to return a measure of error or a measure of transform-robutness.
    :return: Either the error rate or transform-robustness depending on err_rate.
    """
    img_tensor = np.zeros((batch_size, imgs[0].shape[0], imgs[0].shape[1], imgs[0].shape[2]), dtype=np.float32)
    num_successes = 0
    tar_tensor = np.ones((batch_size)) * target

    count = 0
    for i, img in enumerate(imgs):
        max_y = min(img.shape[0], img_tensor.shape[1])
        max_x = min(img.shape[1], img_tensor.shape[2])
        img_tensor[count, :max_y, :max_x, :] = img[:max_y, :max_x, :]
        count += 1
        if count == batch_size or i == len(imgs) - 1:
            if count < batch_size:
                img_tensor = img_tensor[:count, :, :, :]
                tar_tensor = tar_tensor[:count]

            if estimator.channels_first:
                transposed = np.transpose(img_tensor, (0, 3, 1, 2))
                preds = get_labels_np_array(estimator.predict(transposed, batch_size=batch_size))
            else:
                preds = get_labels_np_array(estimator.predict(img_tensor, batch_size=batch_size))
            np_preds = np.argmax(preds)
            num_successes += (np_preds == tar_tensor).sum().item()
            count = 0

    return_val = (1.0 - num_successes * 1.0 / len(imgs)) if err_rate else num_successes * 1.0 / len(imgs)
    return return_val

    Run model predictions over batch of input.

    :param estimator: The model.
    :param imgs: Batch of images with different transforms.
    :param target: Target label.
    :param batch_size: Size of batches to process.
    :param err_rate: Whether to return a measure of error or a measure of transform-robutness.
    :return: Either the error rate or transform-robustness depending on err_rate.
    
art/attacks/evasion/graphite/utils.py