評價此頁

torch.nn.functional.poisson_nll_loss#

torch.nn.functional.poisson_nll_loss(input, target, log_input=True, full=False, size_average=None, eps=1e-08, reduce=None, reduction='mean')[原始碼]#

計算泊松負對數似然損失。

詳細資訊請參閱 PoissonNLLLoss

引數
  • input (Tensor) – 潛在泊松分佈的期望值。

  • target (Tensor) – 隨機樣本 targetPoisson(input)target \sim \text{Poisson}(input)

  • log_input (bool) – 如果為 True,則損失計算為 exp(input)targetinput\exp(\text{input}) - \text{target} * \text{input},如果為 False,則損失為 inputtargetlog(input+eps)\text{input} - \text{target} * \log(\text{input}+\text{eps}). 預設為 True

  • full (bool) – 是否計算完整的損失,即加上斯特林近似項。預設為 False targetlog(target)target+0.5log(2πtarget)\text{target} * \log(\text{target}) - \text{target} + 0.5 * \log(2 * \pi * \text{target})

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

  • eps (float, optional) – 當 log_inputFalse 時,用於避免計算 log(0)\log(0) 的小值。預設為 1e-8。

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

  • reduction (str, optional) – 指定應用於輸出的歸約方式:'none' | 'mean' | 'sum''none':不應用歸約;'mean':輸出的總和除以輸出的元素數量;'sum':對輸出進行求和。注意:size_averagereduce 正在被棄用,在此期間,指定這兩個引數中的任何一個都將覆蓋 reduction。預設為 'mean'

返回型別

張量