Skip to content

Add shape validation in psnr function in metrics.py#11

Open
agentksimha wants to merge 1 commit intohumanai-foundation:mainfrom
agentksimha:fix/psnr-shape-validation
Open

Add shape validation in psnr function in metrics.py#11
agentksimha wants to merge 1 commit intohumanai-foundation:mainfrom
agentksimha:fix/psnr-shape-validation

Conversation

@agentksimha
Copy link

Change made to ArtExtract_Soyoung/utils/metrics.py:

The psnr function computes element-wise differences between output and target with no check that their shapes match. A shape mismatch triggers a cryptic PyTorch broadcasting error with no indication of which tensors are involved or what their shapes are. Added a check at the top of the function that raises ValueError with the exact shapes of both tensors if they do not match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant