Hi
I agree it’s very fun to write one liners like that, but that does not really make the code easily readable.
One thing to check is wether or not your output does require gradients or not. In this case, I think the left side of the multiplication won’t as the __eq__ operation is not differentiable.
The right side though should be differentiable. (as long as v is a Tensor that requires gradients).
For testing if the gradients computed are the actual gradients of your function, you can use our gradcheck 57 utility. You must run this in double precision. And it will check that gradients computed with finite difference match the ones from the autograd.