codecamp

TensorFlow函数:tf.losses.hinge_loss

tf.losses.hinge_loss函数

tf.losses.hinge_loss(
    labels,
    logits,
    weights=1.0,
    scope=None,
    loss_collection=tf.GraphKeys.LOSSES,
    reduction=Reduction.SUM_BY_NONZERO_WEIGHTS
)

定义在:tensorflow/python/ops/losses/losses_impl.py.

在训练过程中增加了hinge loss.

参数:

  • labels:真实输出张量,它的形状应该与logits的形状相匹配;张量的值预计为0.0或1.0.
  • logits:logits,一个浮动张量.
  • weights:可选的Tensor,其秩为0或与labels的秩相同,并且必须可广播到labels(即,所有维度必须1,与相应的losses维度相同).
  • scope:计算loss时执行的操作范围.
  • loss_collection:将添加loss的集合.
  • reduction:适用于loss的减少类型.

返回:

加权损失浮动Tensor.如果reduction是NONE,则它的形状与labels相同;否则,它是标量.

可能引发的异常:

  • ValueError:如果logits和labels的形状不匹配,或者如果labels或logits是None.
TensorFlow函数:tf.losses.get_total_loss
TensorFlow函数:tf.losses.huber_loss
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }