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

淘宝做基础销量怎么网站汕头seo不错

淘宝做基础销量怎么网站,汕头seo不错,株洲网站网络推广怎么做,云南建设厅网站安全员报名入口神经网络的基本骨架 1. nn.Module的使用 所有的模型都要继承 Module 类需要重写初始化函数和运算步骤函数 eg#xff1a; import torch.nn as nn import torch.nn.functional as Fclass Model(nn.Module): # 继承父类Module def __init__(self): # 重写初始化函数super()…神经网络的基本骨架 1. nn.Module的使用 所有的模型都要继承 Module 类需要重写初始化函数和运算步骤函数 eg import torch.nn as nn import torch.nn.functional as Fclass Model(nn.Module): # 继承父类Module def __init__(self): # 重写初始化函数super().__init__() # 调用父类初始化self.conv1 nn.Conv2d(1, 20, 5)self.conv2 nn.Conv2d(20, 20, 5)def forward(self, x): # 神经网络的运算步骤--前向传播x F.relu(self.conv1(x)) # x-卷积-非线性return F.relu(self.conv2(x)) # x-卷积-非线性代码示例 import torch from torch import nnclass Kun(nn.Module):def __init__(self):super().__init__()def forward(self, input):output input1 # 实现输出加1return outputkun Kun() x torch.tensor(1.0) output kun(x) print(output) # tensor(2.)2. 卷积 conv2可选参数 卷积计算过程示意 import torch# 输入图像5*5 input torch.tensor([[1, 2, 0, 3, 1],[0, 1, 2, 3, 1],[1, 2, 1, 0, 0],[5, 2, 3, 1, 1],[2, 1, 0, 1, 1]]) # 输入tensor数据类型的二维矩阵# 卷积核 kernel torch.tensor([[1, 2, 1],[0, 1, 0],[2, 1, 0]])print(input.shape) print(kernel.shape)torch.Size([5, 5]) torch.Size([3, 3])如果不调整尺寸会报错Expected 3D(unbatched) or 4D(batched) input to conv2d, but got input of size: [5, 5] 所以需要调整 input torch.reshape(input, (1, 1, 5, 5)) kernel torch.reshape(kernel, (1, 1, 3, 3))output F.conv2d(input, kernel, stride1) print(output)-------------------------------------------------------------------------- tensor([[[[10, 12, 12],[18, 16, 16],[13, 9, 3]]]])stride可以选择移动的步长 output2 F.conv2d(input, kernel, stride2) print(output2) ---------------------------------------------------------------------------- tensor([[[[10, 12],[13, 3]]]])padding进行填充(默认填充0) output3 F.conv2d(input, kernel, stride1, padding1) print(output3) ----------------------------------------------------------------------------- tensor([[[[ 1, 3, 4, 10, 8],[ 5, 10, 12, 12, 6],[ 7, 18, 16, 16, 8],[11, 13, 9, 3, 4],[14, 13, 9, 7, 4]]]])示例代码 import torch import torch.nn.functional as F # 输入图像5*5 input torch.tensor([[1, 2, 0, 3, 1],[0, 1, 2, 3, 1],[1, 2, 1, 0, 0],[5, 2, 3, 1, 1],[2, 1, 0, 1, 1]]) # 输入tensor数据类型的二维矩阵# 卷积核 kernel torch.tensor([[1, 2, 1],[0, 1, 0],[2, 1, 0]]) # 调整输入的尺寸 # 如果不调整尺寸会报错 # Expected 3D(unbatched) or 4D(batched) input to conv2d, but got input of size: [5, 5] input torch.reshape(input, (1, 1, 5, 5)) kernel torch.reshape(kernel, (1, 1, 3, 3)) # print(input.shape) # torch.Size([1, 1, 5, 5]) # print(kernel.shape) # torch.Size([1, 1, 3, 3])output F.conv2d(input, kernel, stride1) print(output)output2 F.conv2d(input, kernel, stride2) print(output2)output3 F.conv2d(input, kernel, stride1, padding1) print(output3)
http://www.yayakq.cn/news/5523/

相关文章:

  • 建设进出口外贸网站最新国际热点新闻事件
  • 网站备案在线注销江苏省建设工程信息一体化平台
  • 深圳网站建设力荐上榜网络个体可以做企业网站吗
  • 黄冈网站建设哪家好手机网站模板 psd
  • 家里电脑做网站服务器网站建设首页需要哪些元素
  • 做网站现在什么最赚钱吗网站 免费空间
  • 湖北省建设工程人力资源网站建设网站需要做什么
  • 轻松建站wordpress gonzo
  • 快速收录网站内页自己做下载网站吗
  • 高大上网站wordpress 2.6
  • 安阳信息港网站wordpress 中文安装
  • 怎么做粉丝福利购网站品牌高端网站制作机构
  • 微信版网站制作个人网站建设课程
  • 鄂尔多斯市建设网站上海松江网站设计公司
  • 网站开发具体的工作内容上传网站内容
  • 云南外贸建站推广区块链做网站都有哪些内容呢
  • 网站建设较好的公司邢台建网站的公司
  • wordpress网站标题自定义网络营销推广工具有哪些?
  • 找能做网站的江西建设局网站
  • 部署一个网站大概多少钱做图片网站
  • 建设一个棋牌网站都得准备什么用wordpress 怎么安装
  • 如何做电子海报在网站网站管理员登陆不了
  • 网站app推广怎么做手机微网站平台登录入口
  • 企业管理系统网站开发标书如何创建一个app
  • 网站开发结构有深圳宝安区很穷吗
  • 对单位网站的要求吗视频生成网址链接
  • 网站后台管理界面html中国网站建设平台
  • 沧州市高速公路建设管理局网站下陆区建设局网站
  • 网站建设合同用缴印花税吗如何搭建微商城
  • 织梦旅游网站官方网站aspcms