It raise the same jacobin error after i change the code like you suggest 

Yes the code change was just for clarity 

I think the probaility of this happen is very low, so i think the diffierentiability is not the reason why the error raised. 

In theory yes. In practice, if you generate hundreds of Tensors with values between 0-1. How probable is it that two of them are less than 0.5e-3 (half the eps used, meaning that the max will change and we will cross over a point of non-differentiability where the numerical gradient will return garbage) appart?

Yes, i convert them back to float at pytorch class encapsulation layer before doing the actual computation

That might be the issue. In my experience, single precision floats are hard to get to work with gradcheck.
You will need to raise the epsilon (more issues with non-differentiable points as mentioned above) and the tolerance quite a lot.
Can you add a simple float/double template to your function by any chance?
Otherwise, you won’t be able to use the gradcheck blindly and you’ll have to play with the eps/threshold and see when it passes, when it fails and try and get a feeling to know if it’s a numerical precision or formula issue.