Hi,
Autograd has support for indexing but cannot compute gradients when they don’t exist.
In particular, given that lambda is a threshold, if you ask for the gradient wrt lambda, you will get a function that is 0 almost everywhere. So you cannot learn lambda by gradient descent-like methods.