compute mini-batch gradient