calc_gradient api for format picking