def labels_from_probs(probs):
 last_axis = (len(np.shape(probs)) - 1)
 labels = np.argmax(probs, axis=last_axis)
 return np.asarray(labels, dtype=np.int32)

def labels_from_probs ( probs ) : last_axis = ( len ( np . shape ( probs ) ) - 1 ) labels = np . argmax ( probs , axis = last_axis ) return np . asarray ( labels , dtype = np . int32 )
helper function: computes argmax along last dimension of array to obtain labels .