栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

通过torch.normal创建四种模式的正态分布张量

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

通过torch.normal创建四种模式的正态分布张量

  1. torch.normal(mean, std, out=None)
  2. 功能:生成正态分布(高斯分布)
    • mean: 均值
    • std: 标准差
    • 四种模式:
      • mean为标量,std为标量
      • mean为标量,std为张量
      • mean为张量,std为标量
      • mean为张量,std为张量
        torch.normal(0,1,size=(1,5))
        tensor([[ 0.5548,  0.1402,  0.5849,  1.2391, -0.2564]])
        
        torch.normal(0,std=torch.arange(1, 0, -0.1))
        tensor([-0.6172, -0.1014,  0.0054, -0.0847,  0.2791, -0.0295, -0.1140, -0.3000,
                -0.2172,  0.0075])
        
        torch.normal(mean=torch.arange(1., 11.),std = 10)
        tensor([  0.0548,  33.3666,   6.6326,  -3.3032,  16.0448,  18.3752, -12.6373,
                 -0.1594,  16.0896,  12.4073])
        
        torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1))
        tensor([-0.1131,  2.1779,  2.9984,  3.9909,  4.2449,  6.1312,  6.7345,  7.6574,
                 8.8338, 10.1323])

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/309051.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号