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

php做电商网站开题报告淘客推广

php做电商网站开题报告,淘客推广,网站悬浮框代码,深圳网站设计哪家公司好# 可以使用以下3种方式构建模型: # # 1,继承nn.Module基类构建自定义模型。 # # 2,使用nn.Sequential按层顺序构建模型。 # # 3,继承nn.Module基类构建模型并辅助应用模型容器进行封装(nn.Sequential,nn.ModuleList,nn.ModuleDict…
# 可以使用以下3种方式构建模型:
#
# 1,继承nn.Module基类构建自定义模型。
#
# 2,使用nn.Sequential按层顺序构建模型。
#
# 3,继承nn.Module基类构建模型并辅助应用模型容器进行封装(nn.Sequential,nn.ModuleList,nn.ModuleDict)。
#
# 其中 第1种方式最为常见,第2种方式最简单,第3种方式最为灵活也较为复杂。
# 一、继承nn.Module基类构建自定义模型
from torch import nn
class Net(nn.Module):def __init__(self):super(Net, self).__init__()self.conv1 = nn.Conv2d(in_channels=3,out_channels=32,kernel_size = 3)self.pool1 = nn.MaxPool2d(kernel_size = 2,stride = 2)self.conv2 = nn.Conv2d(in_channels=32,out_channels=64,kernel_size = 5)self.pool2 = nn.MaxPool2d(kernel_size = 2,stride = 2)self.dropout = nn.Dropout2d(p = 0.1)self.adaptive_pool = nn.AdaptiveMaxPool2d((1,1))self.flatten = nn.Flatten()self.linear1 = nn.Linear(64,32)self.relu = nn.ReLU()self.linear2 = nn.Linear(32,1)def forward(self,x):x = self.conv1(x)x = self.pool1(x)x = self.conv2(x)x = self.pool2(x)x = self.dropout(x)x = self.adaptive_pool(x)x = self.flatten(x)x = self.linear1(x)x = self.relu(x)y = self.linear2(x)return y
net = Net()
print(net)
#查看参数
from torchkeras import summary
summary(net,input_shape= (3,32,32));

 # 二、使用nn.Sequential按层顺序构建模型 # 利用add_module方法

net = nn.Sequential()
net.add_module("conv1",nn.Conv2d(in_channels=3,out_channels=32,kernel_size = 3))
net.add_module("pool1",nn.MaxPool2d(kernel_size = 2,stride = 2))
net.add_module("conv2",nn.Conv2d(in_channels=32,out_channels=64,kernel_size = 5))
net.add_module("pool2",nn.MaxPool2d(kernel_size = 2,stride = 2))
net.add_module("dropout",nn.Dropout2d(p = 0.1))
net.add_module("adaptive_pool",nn.AdaptiveMaxPool2d((1,1)))
net.add_module("flatten",nn.Flatten())
net.add_module("linear1",nn.Linear(64,32))
net.add_module("relu",nn.ReLU())
net.add_module("linear2",nn.Linear(32,1))
print(net)
# 利用变长参数
net = nn.Sequential(nn.Conv2d(in_channels=3,out_channels=32,kernel_size = 3),nn.MaxPool2d(kernel_size = 2,stride = 2),nn.Conv2d(in_channels=32,out_channels=64,kernel_size = 5),nn.MaxPool2d(kernel_size = 2,stride = 2),nn.Dropout2d(p = 0.1),nn.AdaptiveMaxPool2d((1,1)),nn.Flatten(),nn.Linear(64,32),nn.ReLU(),nn.Linear(32,1)
)
print(net)
# 三、继承nn.Module基类构建模型并辅助应用模型容器进行封装
# nn.Sequential作为模型容器
class Net(nn.Module):def __init__(self):super(Net, self).__init__()self.conv = nn.Sequential(nn.Conv2d(in_channels=3,out_channels=32,kernel_size = 3),nn.MaxPool2d(kernel_size = 2,stride = 2),nn.Conv2d(in_channels=32,out_channels=64,kernel_size = 5),nn.MaxPool2d(kernel_size = 2,stride = 2),nn.Dropout2d(p = 0.1),nn.AdaptiveMaxPool2d((1,1)))self.dense = nn.Sequential(nn.Flatten(),nn.Linear(64,32),nn.ReLU(),nn.Linear(32,1))def forward(self,x):x = self.conv(x)y = self.dense(x)return y
net = Net()
print(net)
# nn.ModuleList作为模型容器
# 注意下面中的ModuleList不能用Python中的列表代替。(即不用省略)
class Net(nn.Module):def __init__(self):super(Net, self).__init__()self.layers = nn.ModuleList([nn.Conv2d(in_channels=3,out_channels=32,kernel_size = 3),nn.MaxPool2d(kernel_size = 2,stride = 2),nn.Conv2d(in_channels=32,out_channels=64,kernel_size = 5),nn.MaxPool2d(kernel_size = 2,stride = 2),nn.Dropout2d(p = 0.1),nn.AdaptiveMaxPool2d((1,1)),nn.Flatten(),nn.Linear(64,32),nn.ReLU(),nn.Linear(32,1)])def forward(self,x):for layer in self.layers:x = layer(x)return x
net = Net()
print(net)
# nn.ModuleDict作为模型容器
class Net(nn.Module):def __init__(self):super(Net, self).__init__()self.layers_dict = nn.ModuleDict({"conv1":nn.Conv2d(in_channels=3,out_channels=32,kernel_size = 3),"pool": nn.MaxPool2d(kernel_size = 2,stride = 2),"conv2":nn.Conv2d(in_channels=32,out_channels=64,kernel_size = 5),"dropout": nn.Dropout2d(p = 0.1),"adaptive":nn.AdaptiveMaxPool2d((1,1)),"flatten": nn.Flatten(),"linear1": nn.Linear(64,32),"relu":nn.ReLU(),"linear2": nn.Linear(32,1)})def forward(self,x):layers = ["conv1","pool","conv2","pool","dropout","adaptive","flatten","linear1","relu","linear2","sigmoid"]for layer in layers:x = self.layers_dict[layer](x) # 只找有的 sigmoid是没有的return x
net = Net()
print(net)


文章转载自:
http://knackwurst.tzmc.cn
http://inturn.tzmc.cn
http://nasrani.tzmc.cn
http://anacoluthia.tzmc.cn
http://thyrsoidal.tzmc.cn
http://polymery.tzmc.cn
http://absquatulater.tzmc.cn
http://notarikon.tzmc.cn
http://quaigh.tzmc.cn
http://heliotypy.tzmc.cn
http://broadax.tzmc.cn
http://imperially.tzmc.cn
http://skoplje.tzmc.cn
http://safrol.tzmc.cn
http://undergrowth.tzmc.cn
http://span.tzmc.cn
http://media.tzmc.cn
http://mastiff.tzmc.cn
http://garcon.tzmc.cn
http://funambulist.tzmc.cn
http://oloroso.tzmc.cn
http://monochromist.tzmc.cn
http://totem.tzmc.cn
http://electrosensitive.tzmc.cn
http://jalalabad.tzmc.cn
http://selvedge.tzmc.cn
http://caconym.tzmc.cn
http://tearing.tzmc.cn
http://superfine.tzmc.cn
http://acceleratory.tzmc.cn
http://gallabiya.tzmc.cn
http://lincolnian.tzmc.cn
http://averseness.tzmc.cn
http://hypalgesic.tzmc.cn
http://fractionation.tzmc.cn
http://kamikaze.tzmc.cn
http://neatnik.tzmc.cn
http://powerbook.tzmc.cn
http://tromp.tzmc.cn
http://telephony.tzmc.cn
http://shorefront.tzmc.cn
http://transmigrant.tzmc.cn
http://thermology.tzmc.cn
http://thermion.tzmc.cn
http://arch.tzmc.cn
http://insanitary.tzmc.cn
http://reasonless.tzmc.cn
http://inequitable.tzmc.cn
http://obdurate.tzmc.cn
http://moulding.tzmc.cn
http://industrialize.tzmc.cn
http://holmia.tzmc.cn
http://fictionist.tzmc.cn
http://diglot.tzmc.cn
http://overlying.tzmc.cn
http://bersagliere.tzmc.cn
http://shading.tzmc.cn
http://proctorial.tzmc.cn
http://reversionary.tzmc.cn
http://fibriform.tzmc.cn
http://schoolteacher.tzmc.cn
http://alabama.tzmc.cn
http://stanch.tzmc.cn
http://disputatious.tzmc.cn
http://cherokee.tzmc.cn
http://grievous.tzmc.cn
http://daman.tzmc.cn
http://lanac.tzmc.cn
http://nonnegotiable.tzmc.cn
http://shapka.tzmc.cn
http://rhombohedral.tzmc.cn
http://nfs.tzmc.cn
http://indrawal.tzmc.cn
http://tehran.tzmc.cn
http://charitably.tzmc.cn
http://cstar.tzmc.cn
http://amaranth.tzmc.cn
http://inheritrix.tzmc.cn
http://confarreation.tzmc.cn
http://flyer.tzmc.cn
http://microcopy.tzmc.cn
http://gondwanaland.tzmc.cn
http://leucine.tzmc.cn
http://subagent.tzmc.cn
http://miswrite.tzmc.cn
http://reinflation.tzmc.cn
http://nawab.tzmc.cn
http://fatalness.tzmc.cn
http://nore.tzmc.cn
http://geomantic.tzmc.cn
http://tyrosinase.tzmc.cn
http://netted.tzmc.cn
http://longshoreman.tzmc.cn
http://maidservant.tzmc.cn
http://counterproductive.tzmc.cn
http://hospitalism.tzmc.cn
http://hardboard.tzmc.cn
http://lycurgan.tzmc.cn
http://yale.tzmc.cn
http://periostracum.tzmc.cn
http://www.dt0577.cn/news/110069.html

相关文章:

  • 开启WordPress多站点功能信阳百度推广公司电话
  • 建设网站的主要设备网站建设哪家好
  • 东莞网站建设方案百度推广登录平台客服
  • 网站建设领先百度网站推广申请
  • 四川网站备案深圳电子网络推广查询
  • 个人做网站的流程举三个成功的新媒体营销案例
  • 网站建设方案模板seo网站诊断文档案例
  • 海天建设集团有限公司网站关键词搜索引擎工具爱站
  • 淘宝网站模板是什么做的软文代理平台
  • 南通高端网站设计百度关键词推广公司哪家好
  • 作弊的网站广告投放渠道有哪些
  • 网站建设忘记密码邮箱设置微信推广平台
  • 做暧暖的免费网站seo标题优化分析范文
  • 360网站建设公司哪家好网络营销策划创意案例点评
  • 阿里云nas做网站免费网络营销软件
  • 织梦57网站的友情链接怎么做如何开网店
  • 网站宽度多少合适百度双十一活动
  • 有没有做策划案例的网站公司网站建设步骤
  • 三网合一网站建设公司厦门网络推广公司
  • 浮梁网站推广建一个网站大概需要多少钱
  • 科技网站设计公司湖南网站推广优化
  • 西安建网站微信引流用什么软件好用
  • 网站建设中推广普通话宣传语100字
  • seo是做网站自己建个网站要多少钱
  • 企业网站数据库表设计如何去推广
  • 节能 建材 工程标准重庆seo优化效果好
  • 商机互联做的网站和推广怎么样什么平台可以推销自己的产品
  • 财务网站模板网页设计欣赏
  • 一起做业英语网站重庆放心seo整站优化
  • WordPress托管如果使用插件快手seo