torch mseloss_pytorch conv1d

torch mseloss_pytorch conv1dMSELOSSCLASStorch.nn.MSELoss(size_average=None,reduce=None,reduction:str=’mean’)创建一个标准来测量输入x和目标y中每个元素之间的均方误差(L2范数平方)。未减少的损失(即reduction设置为’none’)可以描述为:其中N是batchsize.如果reduction不是’none'(默认为’mean’),那么:x和y是任意形状的张量,每个张量总共有n个元素…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

MSELOSS

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

创建一个标准来测量输入x和目标y中每个元素之间的均方误差(L2范数平方)

未减少的损失(即 reduction 设置为 'none')可以描述为:

\ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad l_n = \left( x_n - y_n \right)^2,ℓ(x,y)=L={l1​,…,lN​}⊤,ln​=(xn​−yn​)2,

其中 N 是 batch size. 如果 reduction 不是 'none' (默认为 'mean'), 那么:

\ell(x, y) = \begin{cases} \operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\ \operatorname{sum}(L), & \text{if reduction} = \text{'sum'.} \end{cases}ℓ(x,y)={mean(L),sum(L),​if reduction=’mean’;if reduction=’sum’.​

x和y是任意形状的张量,每个张量总共有n个元素。

平均值运算仍对所有元素进行运算,并除以n。

如果设置 reduction = 'sum',则可以避免除以n。

Parameters

  • size_average (booloptional) – Deprecated (see reduction). By default, the losses are averaged over each loss element in the batch. Note that for some losses, there are multiple elements per sample. If the field size_average is set to False, the losses are instead summed for each minibatch. Ignored when reduce is False. Default: True。默认情况下,损失是batch中每个损失元素的平均数。 请注意,对于某些损失,每个样本有多个元素。 如果将size_average字段设置为False,则损失是每个minibatch的总和。 当reduce为False时被忽略。 默认值:True。

  • reduce (booloptional) – Deprecated (see reduction). By default, the losses are averaged or summed over observations for each minibatch depending on size_average. When reduce is False, returns a loss per batch element instead and ignores size_average. Default: True。默认情况下,根据size_average对每个minibatch的观察结果求平均或求和。 当reduce为False时,返回每个batch元素损失,并忽略size_average。 默认值:True。

  • reduction (stringoptional) – Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum''none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'。指定要应用于输出的缩减量:’none’| “mean” | ‘sum’。 ‘none’:不应用任何reduction,’mean’:输出的总和除以输出中元素的数量,’sum’:输出的总和。 注意:size_average和reduce正在弃用过程中,与此同时,指定这两个args中的任何一个将覆盖reduction。 默认值:’mean’。

Shape:

  • Input: (N, ∗) where ∗ means, any number of additional dimensions

  • Target: (N, ∗) , same shape as the input

Examples:

>>> loss = nn.MSELoss()
>>> input = torch.randn(3, 5, requires_grad=True)
>>> target = torch.randn(3, 5)
>>> output = loss(input, target)
>>> output.backward()
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

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

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 设计模式(4)-对象创建型模式-Prototype模式

    设计模式(4)-对象创建型模式-Prototype模式

    2022年1月22日
    51
  • vscode运行python_vscode python 调试

    vscode运行python_vscode python 调试Vscode+python+flake8安装配置使用总述Vscode+python环境下,配置flake8与yapf,以及使用方法1.1. Flake8——Python静态代码检查工具Flake8是由Python官方发布的一款辅助检测Python代码是否规范的工具,相对于目前热度比较高的Pylint来说,Flake8检查规则灵活,支持集成额外插件,扩展性强。Flake8是对下面三个工具的封装: PyFlakes:静态检查Python代码逻辑错误的工具。 Pep8:静态检查PEP

    2025年11月3日
    7
  • Android常用控件

    Android常用控件TextView显示文本<TextViewandroid:id="@+id/text_view"android:layout_width="match_pa

    2022年7月2日
    24
  • 目标检測的图像特征提取之(一)HOG特征

    目标检測的图像特征提取之(一)HOG特征

    2021年11月29日
    48
  • Json交互处理_stata交互项检验

    Json交互处理_stata交互项检验Json交互处理JSON简介JSON(JavaScriptObjectNotation,JS对象标记)是一种轻量级的数据交换格式,目前使用特别广泛。采用完全独立于编程语言的文本格式来存储和表示数据。简洁和清晰的层次结构使得JSON成为理想的数据交换语言。易于人阅读和编写,同时也易于机器解析和生成,并有效地提升网络传输效率。在JavaScript语言中,一切都是对象。因此,任何JavaScript支持的类型都可以通过JSON来表示,例如字符串、数字、对象、数组等。看看他

    2022年10月15日
    4
  • Hybrid开发框架一、Weex

    Hybrid开发框架一、Weex前言最近开始试水Weex开发,使用这么长一段时间,感觉写Weex还是非常方便的。作为一个Android开发,免不了要追查一下weex的sdk源码。今天,就以WeexSDKforAndroid为例,分析SDK的认识WeexSDK源码https://github.com/alibaba/weex/tree/dev/android整体分析下拉,按照js文件的渲染过程,绘制出了下面…

    2022年9月22日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号