torch.nn.functional.mse_loss¶ torch.nn.functional.mse_loss(input, target, size_average=None, reduce=None, reduction='mean', weight=None) → Tensor[原始碼][原始碼]¶ 計算逐元素的均方誤差,可選擇加權。 引數 input (Tensor) – 預測值。 target (Tensor) – 真實值。 size_average (bool, 可選) – 已棄用 (請使用 reduction)。 reduce (bool, 可選) – 已棄用 (請使用 reduction)。 reduction (str, 可選) – 指定應用於輸出的 reduction:‘none’ | ‘mean’ | ‘sum’。‘mean’:對輸出取平均值。‘sum’:對輸出求和。‘none’:不應用 reduction。預設值:‘mean’。 weight (Tensor, 可選) – 每個樣本的權重。預設值:None。 返回 均方誤差損失 (可選加權)。 返回型別 Tensor