net: remove num-labels from get-cost-and-gradient