当前位置: 首页 > news >正文

深入浅出Pytorch函数——torch.nn.init.normal_

分类目录:《深入浅出Pytorch函数》总目录
相关文章:
· 深入浅出Pytorch函数——torch.nn.init.calculate_gain
· 深入浅出Pytorch函数——torch.nn.init.uniform_
· 深入浅出Pytorch函数——torch.nn.init.normal_
· 深入浅出Pytorch函数——torch.nn.init.constant_
· 深入浅出Pytorch函数——torch.nn.init.ones_
· 深入浅出Pytorch函数——torch.nn.init.zeros_
· 深入浅出Pytorch函数——torch.nn.init.eye_
· 深入浅出Pytorch函数——torch.nn.init.dirac_
· 深入浅出Pytorch函数——torch.nn.init.xavier_uniform_
· 深入浅出Pytorch函数——torch.nn.init.xavier_normal_
· 深入浅出Pytorch函数——torch.nn.init.kaiming_uniform_
· 深入浅出Pytorch函数——torch.nn.init.kaiming_normal_
· 深入浅出Pytorch函数——torch.nn.init.trunc_normal_
· 深入浅出Pytorch函数——torch.nn.init.orthogonal_
· 深入浅出Pytorch函数——torch.nn.init.sparse_


torch.nn.init模块中的所有函数都用于初始化神经网络参数,因此它们都在torc.no_grad()模式下运行,autograd不会将其考虑在内。

该函数从给定均值和标准差的正态分布 N ( mean , std ) N(\text{mean}, \text{std}) N(mean,std)中生成值,填充输入的张量或变量

语法

torch.nn.init.normal_(tensor, mean=0.0, std=1.0)

参数

  • tensor:[Tensor] 一个 N N N维张量torch.Tensor
  • mean :[float] 正态分布的均值
  • std :[float] 正态分布的标准差

返回值

一个torch.Tensor且参数tensor也会更新

实例

w = torch.empty(3, 5)
nn.init.normal_(w)

函数实现

def normal_(tensor: Tensor, mean: float = 0., std: float = 1.) -> Tensor:r"""Fills the input Tensor with values drawn from the normaldistribution :math:`\mathcal{N}(\text{mean}, \text{std}^2)`.Args:tensor: an n-dimensional `torch.Tensor`mean: the mean of the normal distributionstd: the standard deviation of the normal distributionExamples:>>> w = torch.empty(3, 5)>>> nn.init.normal_(w)"""if torch.overrides.has_torch_function_variadic(tensor):return torch.overrides.handle_torch_function(normal_, (tensor,), tensor=tensor, mean=mean, std=std)return _no_grad_normal_(tensor, mean, std)
http://www.lryc.cn/news/134289.html

相关文章:

  • Vue.js知识点学习的一点笔记
  • Sui第四轮资助:16个团队瓜分
  • ATC模型转换环境问题案例
  • dart其他语法
  • C++11并发与多线程笔记(7) 单例设计模式共享数据分析、解决,call_once
  • FANUC机器人加减速倍率指令ACC的使用方法说明
  • 奥威BI数据可视化工具:360度呈现数据,告别枯燥表格
  • C# Linq源码分析之Take (三)
  • Linux journalctl命令详解(journalctl指令)(systemd服务默认日志管理工具)
  • 学习内容--
  • Stable Diffusion:使用自己的数据集微调训练LoRA模型
  • 软考高级系统架构设计师系列之:论文典型试题写作要点和写作素材总结系列文章一
  • 06 mysql all查询 和 主键查询 和 非索引列查询
  • 黑马点评-项目集成git及redis实现短信验证码登录
  • mac苹果电脑怎么运行Windows软件?怎么安装Win虚拟机?
  • Jmeter对websocket进行测试
  • 从2023年世界机器人大会发现机器人新趋势
  • Kafka单节点部署
  • 生成式AI和大语言模型 Generative AI LLMs
  • Obsidian 入门使用手册
  • GuLi商城-前端基础Vue指令-单向绑定双向绑定
  • 前端(十三)——JavaScript 闭包的奥秘与高级用法探索
  • 面试-快速学习计算机网络-UDP/TCP
  • 爱校对如何帮助企业和博客主提高在线可见性?
  • MATLAB中xlsread函数用法
  • Prisma.js:JavaScript中的基于代码的ORM
  • 解决问题:在cocos create中如何从b文件调用到a文件里用CC.resource.load动态加载的图集
  • 分布式 - 消息队列Kafka:Kafka 消费者消费位移的提交方式
  • 如何利用 ChatGPT 进行自动数据清理和预处理
  • PHP“牵手”淘宝商品评论数据采集方法,淘宝API接口申请指南