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

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

分类目录:《深入浅出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不会将其考虑在内。

该函数从均匀分布 U ( a , b ) U(a, b) U(a,b)中生成值,填充输入的张量或变量

语法

torch.nn.init.uniform_(tensor, a=0.0, b=1.0)

参数

  • tensor:[Tensor] 一个 N N N维张量torch.Tensor
  • a:[float] 均匀分布的下界
  • b:[float] 均匀分布的上界

返回值

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

实例

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

函数实现

def uniform_(tensor: Tensor, a: float = 0., b: float = 1.) -> Tensor:r"""Fills the input Tensor with values drawn from the uniformdistribution :math:`\mathcal{U}(a, b)`.Args:tensor: an n-dimensional `torch.Tensor`a: the lower bound of the uniform distributionb: the upper bound of the uniform distributionExamples:>>> w = torch.empty(3, 5)>>> nn.init.uniform_(w)"""if torch.overrides.has_torch_function_variadic(tensor):return torch.overrides.handle_torch_function(uniform_, (tensor,), tensor=tensor, a=a, b=b)return _no_grad_uniform_(tensor, a, b)
http://www.lryc.cn/news/136425.html

相关文章:

  • 会员管理系统实战开发教程02-H5应用创建
  • 记一次由于整型参数错误导致的任意文件上传
  • spring之Spring Security - 实现身份验证与授权
  • 【Unity3D赛车游戏】【二】如何制作一个真实模拟的汽车
  • 【Linux】线程篇Ⅱ:
  • 浅尝OpenResty
  • MySQL分页查询慢怎么办
  • mongodb集群
  • 回归预测 | MATLAB实现WOA-BP鲸鱼优化算法优化BP神经网络多输入单输出回归预测(多指标,多图)
  • 【前端从0开始】JavaSript——循环控制语句
  • 【Elasticsearch】spring-boot-starter-data-elasticsearch的使用以及Elasticsearch集群的连接
  • Python学习笔记_进阶篇(四)_django知识(三)
  • 指针(初阶)
  • Flink内核源码解析--Flink中重要的工作组件和机制
  • Linux 压缩解压(归档管理):tar命令
  • spring boot集成mqtt协议发送和订阅数据
  • 【数据库】详解数据库架构优化思路(两主架构、主从复制、冷热分离)
  • el-table 实现动态表头 静态内容 根据数据显示动态输入框
  • Reids 的整合 Spring Data Redis使用
  • 3D数据转换工具HOOPS Exchange概览
  • 【从零开始的rust web开发之路 一】axum学习使用
  • oracle警告日志\跟踪日志磁盘空间清理
  • 【vue】el-table 数据更新后,刷新表格数据
  • AVL——平衡搜索树
  • TCP通信流程以及一些TCP的相关概念
  • PyTorch学习笔记(十七)——完整的模型验证(测试,demo)套路
  • WPF开篇
  • linux 压缩解压缩
  • centos9 mysql8修改数据库的存储路径
  • 【C++】<Windows编程中消息即事件的处理>