Fixed gradient function to work with second order
Fixed gradient function to work with second order

Was causing a problem during reshaping by assuming only n_dim
gradients would be created, though it could be 4 or more!

jabooth/menpo-archive,patricksnape/menpo,grigorisg9gr/menpo,grigorisg9gr/menpo,yuxiang-zhou/menpo,menpo/menpo,menpo/menpo,grigorisg9gr/menpo,jabooth/menpo-archive,menpo/menpo,patricksnape/menpo,yuxiang-zhou/menpo,jabooth/menpo-archive,mozata/menpo,patricksnape/menpo,yuxiang-zhou/menpo,mozata/menpo,mozata/menpo,jabooth/menpo-archive,mozata/menpo