快捷方式

torch.nn.functional.mse_loss

torch.nn.functional.mse_loss(input, target, size_average=None, reduce=None, reduction='mean', weight=None) Tensor[source][source]

計算逐元素的均方誤差,可選擇性地進行加權。

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

  • target (Tensor) – 真實值。

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

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

  • reduction (str, optional) – 指定套用至輸出的化簡方式:'none' | 'mean' | 'sum'。'mean':取輸出的平均值。'sum':將輸出加總。'none':不套用任何化簡。預設值:'mean'。

  • weight (Tensor, optional) – 每個樣本的權重。預設值:None。

返回值

均方誤差損失(可選擇性地加權)。

返回類型

Tensor

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources