HUJI-Deep/simnets-tf

Make gradient tests for similarity layer more general

Closed this issue · 2 comments

In the current tests of the similarity layer, most cases are not covered. These tests should be generalize to all possible combinations of the different flags supported by the similarity layer, and using random input / parameters.

When making all the tensors constant, I saw that the computed gradients made sense, and the numeric gradients did not. I changed the test by moving the images and templates from 0 (by adding a constant to the random tensor), I also changed the delta of the gradient checker to 0.1 and now the tests pass with the required accuracy

sim_grad_error

You can see that the compted one is symmetric while the numeric one isn't. Looking at the actual numbers prove that the computed one is consistent while the numeric is not.

Anyway, we have exhaustive tests that pass

@orsharir , What do you think? should we close this?