Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size_average=False returns a tensor containing individual SSIM scores instead of returning their sum #29

Open
akashsara opened this issue May 25, 2021 · 0 comments

Comments

@akashsara
Copy link

Hi, I'm not sure if this behavior is intended or not but for a batch of 64 images, when I set size_average=False, i get a tensor of size 64 with individual values:

tensor([1.0004, 0.9843, 0.9976, 0.9938, 0.9879, 0.9989, 0.9916, 0.9976, 1.0069,
        0.9847, 0.9832, 0.9844, 0.9757, 0.9914, 0.9717, 1.0027, 1.0106, 0.9889,
        0.9885, 0.9949, 0.9996, 0.9965, 0.9801, 0.9887, 0.9879, 0.9804, 0.9926,
        0.9856, 0.9896, 0.9936, 0.9950, 0.9941, 0.9911, 0.9860, 0.9886, 0.9949,
        0.9881, 0.9898, 0.9934, 0.9825, 0.9939, 0.9912, 0.9955, 0.9937, 1.0005,
        0.9975, 0.9831, 1.0005, 0.9970, 0.9953, 0.9855, 1.0001, 1.0101, 0.9862,
        0.9960]

The usual approach in PyTorch is:

size_average (bool, optional) – Deprecated (see reduction). By default, the losses are averaged over each loss element in the batch. Note that for some losses, there are multiple elements per sample. If the field size_average is set to False, the losses are instead summed for each minibatch. Ignored when reduce is False. Default: True

Source: https://pytorch.org/docs/stable/generated/torch.nn.MSELoss.html

@akashsara akashsara changed the title size_average=False returns a tensor containing individual MSE scores instead of returning their sum size_average=False returns a tensor containing individual SSIM scores instead of returning their sum May 25, 2021
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

No branches or pull requests

1 participant