Added closed form gradients for cross entropy obj and made it
easy to switch between optimising auto diff/closed form