Efficient gradient computation for optimization of hyperparameters. (7th February 2022)