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

About L2 & TV loss, mean value #16

Open
mountains-high opened this issue Jul 11, 2022 · 1 comment
Open

About L2 & TV loss, mean value #16

mountains-high opened this issue Jul 11, 2022 · 1 comment

Comments

@mountains-high
Copy link

mountains-high commented Jul 11, 2022

Good day,
Thank you for the nice job and for making it open-source ~
I have some doubts about these two losses. Could you please explain why you have taken the "mean of L2 loss and TV loss"?

l2_loss = torch.norm(input[0], dim=1, p=2).mean()

and

loss_var_l1 = (diff1.abs() / 255.0).mean() + (diff2.abs() / 255.0).mean() + (

Thank you ~

@mountains-high
Copy link
Author

These two below gotten from the original source DI/cifar10:
https://github.com/NVlabs/DeepInversion/blob/6d64b65c573a8229844c746d77993b2c0431a3e5/cifar10/deepinversion_cifar10.py#L184
loss_var = torch.norm(diff1) + torch.norm(diff2) + torch.norm(diff3) + torch.norm(diff4)

and

https://github.com/NVlabs/DeepInversion/blob/6d64b65c573a8229844c746d77993b2c0431a3e5/cifar10/deepinversion_cifar10.py#L177
loss = loss + l2_coeff * torch.norm(inputs_jit, 2)
Which will be correct one? Thanks

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