評價此頁

torch.nn.functional.soft_margin_loss#

torch.nn.functional.soft_margin_loss(input, target, size_average=None, reduce=None, reduction='mean')[原始碼]#

計算 soft margin loss。

詳情請參見 SoftMarginLoss

引數
  • input (Tensor) – 預測值。

  • target (Tensor) – 真值。

  • size_average (bool, optional) – 已棄用(請參閱 reduction)。

  • reduce (bool, optional) – 已棄用(請參閱 reduction)。

  • reduction (str, optional) – 指定應用於輸出的約簡:‘none’ | ‘mean’ | ‘sum’。‘mean’:取輸出的平均值。‘sum’:將輸出相加。‘none’:不應用任何約簡。預設為 ‘mean’。

返回

Soft margin loss。

返回型別

張量