pytorch_influence_functions
pytorch_influence_functions copied to clipboard
A potential typo/bug in averaging s_test?
In calc_s_test_single, it seems like the intended operation is to add all the sampled s_test_i together and divide the sum by r
. However, it is actually extending the list. Because of this, it seems like when I set r>1
, calc_influence_single just completely skips s_test_vec[len(grad_z_vec):]
. Am I not understanding what this is doing correctly, or is this a typo? I'm quite unsure because this looks like something intentional, as it's explicitly converted to a list of tensors.
I think it is a bug. The code only uses the first s_test to calculate influence even when r>1.
Just verified and you are right. Gradients are appended instead of added. Fixed this in my repo in this commit https://github.com/nimarb/pytorch_influence_functions/commit/a959de63d77bd8c55c89dee8f045fb7c3e3673fc
I can create a pull request for if @nimarb would like to merge it.