def _cri_cert(self, scores: BK.Expr): # 1.-uncertainty uncertainty = (scores.softmax(-1) * scores.log_softmax(-1)).sum(-1) / ( -math.log(BK.get_shape(scores, -1))) return 1. - uncertainty
def _cri_prob(self, scores: BK.Expr): # max prob return scores.softmax(-1).max(-1)[0] # [*, slen]