损失函数是指用于计算标签值和预测值之间差异的函数,在机器学习过程中,有多种损失函数可供选择,典型的有距离向量,绝对值向量等。...通常都是用在多分类模型中,实际应用中我们一般用 NLLLoss 比较多。7、nn.NLLLoss2d和上面类似,但是多了几个维度,一般用在图片上。...和TensorFlow的 sigmoid_cross_entropy_with_logits;softmax_cross_entropy_with_logitspytorch BCEwithLogitsLoss...Keras binary_crossentropy 也是调用 Tf sigmoid_cross_entropy_with_logits.keras binary_crossentropy 源码;def...[12,3,2],[3,10,1],[1,2,5],[4,6.5,1.2],[3,6,1]])res = loss_fn(logits, y)print(K.get_value(res)) from keras.losses