Calculate gradient for bias.