Python Empty Calc Gradient Learning