pytorch_influence_functions icon indicating copy to clipboard operation
pytorch_influence_functions copied to clipboard

A potential typo/bug in averaging s_test?

Open zlin7 opened this issue 4 years ago • 2 comments

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.

zlin7 avatar Oct 14 '20 23:10 zlin7

I think it is a bug. The code only uses the first s_test to calculate influence even when r>1.

fjzpcmj avatar Aug 01 '21 15:08 fjzpcmj

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.

mkirchhof avatar Aug 16 '21 15:08 mkirchhof