def infer_with_eval(model, hparams, batch_data, metrics):
    """
    Args:
        model: Module.
        hparams: Hparameters.
        batch_data: Tuple; a 2-tuple of the form (input_data, target_data), 
            where input_data is a data point of the form expected by model 
            on input and target_data is a Tensor.
        metrics: List; a sequence of callables which accept 
            a prediction/output tensor and a label/target tensor and return
            a single numeric value.
    Returns:
        A dictionary mapping metric to values. 
    """
    if isinstance(batch_data[1], list) or isinstance(batch_data[1], dict):
        raise ValueError("Unable to perform inference with evaluation on " 
            "complex target data---please use a custom function for this purpose.")
    else:
        target = batch_data[1]

    output = model(batch_data[0])

    return {metric: metric(output, target) for metric in metrics}