# logits 的最后一维=类别数
def sofmax(logits):
e_x = np.exp(logits)
probs = e_x / np.sum(e_x, axis=-1, keepdims=True)
return probs
05-24
907
07-22
643
# logits 的最后一维=类别数
def sofmax(logits):
e_x = np.exp(logits)
probs = e_x / np.sum(e_x, axis=-1, keepdims=True)
return probs