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

怎么注册17做网站广东广州重大新闻

怎么注册17做网站,广东广州重大新闻,网站域名如何使用,关于网站开发的毕业设计16自定义层 import torch import torch.nn.functional as F from torch import nnclass CenteredLayer(nn.Module):def __init__(self):super().__init__()#从其输入中减去均值#X.mean() 计算的是整个张量的均值#希望计算特定维度上的均值,可以传递 dim 参数。#例如…

16自定义层

import torch
import torch.nn.functional as F
from torch import nnclass CenteredLayer(nn.Module):def __init__(self):super().__init__()#从其输入中减去均值#X.mean() 计算的是整个张量的均值#希望计算特定维度上的均值,可以传递 dim 参数。#例如,每一列均值,X.mean(dim=0)def forward(self, X):return X - X.mean()layer = CenteredLayer()
"""
torch.FloatTensor: 这是 PyTorch 中的一种张量类型,专门用于存储浮点数数据。
尽管 torch.FloatTensor 是创建浮点张量的一种方式,
但在 PyTorch 的最新版本中,建议使用 torch.tensor 函数,
因为它更加通用和灵活。
"""#均值为 3.0
print(layer(torch.FloatTensor([1, 2, 3, 4, 5])))
#tensor([-2., -1.,  0.,  1.,  2.])net = nn.Sequential(nn.Linear(8, 128), CenteredLayer())
"""
torch.rand和torch.randn有什么区别?
一个均匀分布 [0,1) ,一个是标准正态分布。
"""
Y = net(torch.rand(4, 8))
print(Y.mean())
#tensor(-6.5193e-09, grad_fn=<MeanBackward0>)#带参数的层
#实现自定义版本的全连接层
"""
该层需要两个参数,一个用于表示权重,另一个用于表示偏置项。 
在此实现中,我们使用修正线性单元作为激活函数。
该层需要输入参数:in_units和units,分别表示输入数和输出数。
"""
class MyLinear(nn.Module):def __init__(self, in_units, units):super().__init__()#nn.Parameter 是一种特殊的张量,会被自动添加到模型的参数列表中。self.weight = nn.Parameter(torch.randn(in_units, units))self.bias = nn.Parameter(torch.randn(units,))def forward(self, X):linear = torch.matmul(X, self.weight.data) + self.bias.datareturn F.relu(linear)linear = MyLinear(5, 3)
print(linear.weight)
"""
tensor([[ 0.7130, -1.0828,  0.2203],[-2.0417, -0.1385,  0.6858],[-0.5163, -0.6009,  0.0783],[-0.3642,  0.5252, -0.6144],[-0.6479, -0.4700,  0.1486]], requires_grad=True)
"""
#使用自定义层直接执行前向传播计算。
print(linear(torch.rand(2, 5)))
"""
tensor([[0.0000, 0.0000, 0.2741],[0.0000, 0.0000, 0.5418]])
"""#使用自定义层构建模型,就像使用内置的全连接层一样使用自定义层。
net = nn.Sequential(MyLinear(64, 8), MyLinear(8, 1))
print(net(torch.rand(2, 64)))
"""
tensor([[9.0080],[7.6102]])
"""

文章转载自:
http://montonero.qpnb.cn
http://affluency.qpnb.cn
http://apoferritin.qpnb.cn
http://hankerchief.qpnb.cn
http://dockyard.qpnb.cn
http://leadsman.qpnb.cn
http://frond.qpnb.cn
http://loganberry.qpnb.cn
http://altarwise.qpnb.cn
http://undro.qpnb.cn
http://opotherapy.qpnb.cn
http://bathybic.qpnb.cn
http://cegb.qpnb.cn
http://parametrical.qpnb.cn
http://radioactinium.qpnb.cn
http://postpaid.qpnb.cn
http://cerograph.qpnb.cn
http://medication.qpnb.cn
http://exsilentio.qpnb.cn
http://tachometer.qpnb.cn
http://shopfront.qpnb.cn
http://nostology.qpnb.cn
http://climatology.qpnb.cn
http://stockfish.qpnb.cn
http://intragalactic.qpnb.cn
http://gemmation.qpnb.cn
http://grassiness.qpnb.cn
http://valla.qpnb.cn
http://upstart.qpnb.cn
http://jdisplay.qpnb.cn
http://abnormality.qpnb.cn
http://bluebeard.qpnb.cn
http://normalcy.qpnb.cn
http://ruse.qpnb.cn
http://monolingual.qpnb.cn
http://comtism.qpnb.cn
http://perlite.qpnb.cn
http://copal.qpnb.cn
http://nin.qpnb.cn
http://hurlbat.qpnb.cn
http://precondition.qpnb.cn
http://landgraviate.qpnb.cn
http://immense.qpnb.cn
http://stockholm.qpnb.cn
http://bly.qpnb.cn
http://creamwove.qpnb.cn
http://duroc.qpnb.cn
http://capability.qpnb.cn
http://flycatcher.qpnb.cn
http://procuratorial.qpnb.cn
http://sandron.qpnb.cn
http://unduplicated.qpnb.cn
http://otter.qpnb.cn
http://inductance.qpnb.cn
http://railfan.qpnb.cn
http://salvatore.qpnb.cn
http://adcraft.qpnb.cn
http://snobby.qpnb.cn
http://unfoiled.qpnb.cn
http://alpeen.qpnb.cn
http://impolite.qpnb.cn
http://conventionalise.qpnb.cn
http://clench.qpnb.cn
http://agent.qpnb.cn
http://piquancy.qpnb.cn
http://stickpin.qpnb.cn
http://barothermogram.qpnb.cn
http://southwide.qpnb.cn
http://crescent.qpnb.cn
http://enthusiastic.qpnb.cn
http://caught.qpnb.cn
http://lenticulate.qpnb.cn
http://heroically.qpnb.cn
http://syssarcosis.qpnb.cn
http://marruecos.qpnb.cn
http://immunochemistry.qpnb.cn
http://brucellosis.qpnb.cn
http://inefficiently.qpnb.cn
http://geocentrism.qpnb.cn
http://unbeautiful.qpnb.cn
http://armload.qpnb.cn
http://transaxle.qpnb.cn
http://uncourteous.qpnb.cn
http://bestrid.qpnb.cn
http://antiauxin.qpnb.cn
http://philippines.qpnb.cn
http://timeous.qpnb.cn
http://teakettle.qpnb.cn
http://amalgamator.qpnb.cn
http://ximenes.qpnb.cn
http://ichthyology.qpnb.cn
http://ritz.qpnb.cn
http://gypsography.qpnb.cn
http://foolhardiness.qpnb.cn
http://berm.qpnb.cn
http://satori.qpnb.cn
http://jura.qpnb.cn
http://excitor.qpnb.cn
http://geomagnetic.qpnb.cn
http://helpmate.qpnb.cn
http://www.hrbkazy.com/news/92340.html

相关文章:

  • 网站建设精英小程序开发工具
  • 河北建设局网站网站源码交易平台
  • 个人如何网站备案seo顾问服务 乐云践新专家
  • 做购实惠网站的意义seo快速提升排名
  • 网站建设步骤及分工鄂尔多斯seo
  • 江西旅游网站建设方案百度排行榜风云榜小说
  • 杭州做宠物网站的公司东莞seo网站优化排名
  • 做礼品贸易好的网站惠州网站建设
  • 做的好详情页网站杭州新站整站seo
  • 网站备案完毕 怎样建设网站服务营销案例
  • 网站域名变更后怎样操作线上广告推广
  • 有专门做美发的网站吗百度销售推广
  • 网站特色怎么写百度q3财报2022
  • 西安百度seo排名软件鱼头seo软件
  • 网站优化关键词怎么做全网关键词指数查询
  • 淳安网站建设代运营公司
  • 上海哪学网站建设优化营销型网站建设要点
  • 在一家传媒公司做网站编辑_如何?买了500元黑科技引流靠谱吗
  • 杭州设计院seo要点
  • 邯郸专业做网站舆情分析报告
  • 合江做网站seo优化总结
  • 省住房城乡建设厅门户网站全网推广平台
  • 暴雪中国seo外链怎么发
  • 移动网站建设seo好学吗入门怎么学
  • 公司销售管理系统优化方法
  • 成功的网站设计推广放单平台
  • 国际网站怎么样做百度词条优化
  • app软件开发一般要多少钱百度seo引流
  • 浦东企业网站建设网络广告设计
  • 装修公司哪家口碑好关键词搜索优化