Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

fix divergence_exact's diagonal sum #1

Closed
wants to merge 1 commit into from
Closed

fix divergence_exact's diagonal sum #1

wants to merge 1 commit into from

Conversation

ventusff
Copy link
Contributor

@ventusff ventusff commented Jan 18, 2021

In run_nerf_helpers.py: L71 divergence_loss, the original code to calculate the diagonal of jacobian matrix is wrong.

I'm guessing since it's using divergence_approx function by default, this error does not affect the default training behavior.
But still it will affect the behavior when setting exact=true for training.

example:

jac[0,...]=
        [[  1.5425,   8.1350,   5.7477],
        [ -1.1500, -14.2937,  -9.5665],
        [ -0.5321,  11.8239,   5.3827]]

jac.view(jac.shape[0], -1)[0,...]=
         [  1.5425, 8.1350, 5.7477, -1.1500, -14.2937, -9.5665, -0.5321, 11.8239, 5.3827]

# wrong way
jac.view(jac.shape[0], -1)[0, :: jac.shape[1]]=
         [ 1.5425, -1.1500, -0.5321]

# correct way
jac.view(jac.shape[0], -1)[0, :: (jac.shape[1]+1)]=
         [  1.5425, -14.2937,   5.3827]

@facebook-github-bot
Copy link

Hi @ventusff!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@ventusff
Copy link
Contributor Author

OK, already signed now

@ventusff ventusff closed this Jan 18, 2021
@ventusff ventusff reopened this Jan 18, 2021
@ventusff
Copy link
Contributor Author

re-open with CLA signed

@ventusff ventusff closed this Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants