zl程序教程

您现在的位置是:首页 >  后端

当前栏目

pytorch最新版本_pytorch linear

PyTorch 版本 最新 linear
2023-06-13 09:13:30 时间

大家好,又见面了,我是你们的朋友全栈君。

1.应用

import torch
import torch.nn as nn

loss = nn.MSELoss()
input = torch.tensor([1.0,1.0], requires_grad=True)
target = torch.tensor([7.0,9.0])
output = loss(input, target) # 50
output.backward()

2.概念

API

mean squared error (squared L2 norm)

CLASS torch.nn.MSELoss(size_average=None, reduce=None, reduction: str = 'mean')

参数

描述

reduction (string, optional)

默认为’mean’。‘mean’:求和取平均;‘sum’:只求和。

实例

参数

描述

Input: (N, *)

where *∗ means, any number of additional dimensions

Target: (N, *)

same shape as the input

参考: https://pytorch.org/docs/stable/generated/torch.nn.MSELoss.html?highlight=mseloss#torch.nn.MSELoss

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/193067.html原文链接:https://javaforall.cn