def corrcoef(pred, target):
    """
    Torch implementation of pearson correlation coefficient.
    
    Args:
        pred (torch): torch model prediction
        target (torch): torch model label
    
    ::References::
    # np.corrcoef in torch from @mdo
    # https://forum.numer.ai/t/custom-loss-functions-for-xgboost-using-pytorch/960
    
    """
    pred_n = pred - pred.mean()
    target_n = target - target.mean()
    pred_n = pred_n / pred_n.norm()
    target_n = target_n / target_n.norm()
    
    return (pred_n * target_n).sum()