a
    d                     @   s(   d dl mZ deeeeddddZdS )    )TensorFN)predstargetnum_outputsallow_1d_reshapereturnc                 C   s   | j dks|j dkr.td|j  d| j  dd}|sX|dkoV| j dkpT| jd dk }|dkov| j dkov|| jd k}|s|rtd| d| jd  ddS )	a  Check that predictions and target have the correct shape, else raise error.

    Args:
        preds: Predicted tensor
        target: Ground truth tensor
        num_outputs: Number of outputs in multioutput setting
        allow_1d_reshape: Allow that for num_outputs=1 that preds and target does not need to be 1d tensors. Instead
            code that follows are expected to reshape the tensors to 1d.

       zWExpected both predictions and target to be either 1- or 2-dimensional tensors, but got z and .F   zPExpected argument `num_outputs` to match the second dimension of input, but got N)ndim
ValueErrorshape)r   r   r   r   Zcond1Zcond2 r   q/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/torchmetrics/functional/regression/utils.py _check_data_shape_to_num_outputs   s$    " r   )F)Ztorchr   intboolr   r   r   r   r   <module>   s
    