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

咋制作网站网络营销的类型

咋制作网站,网络营销的类型,装饰工程有限公司起名大全,我国政府门户网站建设发展现状文章目录 介绍激活函数示例 损失函数示例 卷积操作示例 池化示例 归一化操作示例 Dropout示例 torch.nn.functional 与 torch.nn 的区别 介绍 torch.nn.functional 是 PyTorch 中的一个模块,提供了许多函数式的神经网络操作,包括激活函数、损失函数、卷…

文章目录

  • 介绍
  • 激活函数
    • 示例
  • 损失函数
    • 示例
  • 卷积操作
    • 示例
  • 池化
    • 示例
  • 归一化操作
    • 示例
  • Dropout
    • 示例
  • torch.nn.functional 与 torch.nn 的区别

介绍

torch.nn.functional 是 PyTorch 中的一个模块,提供了许多函数式的神经网络操作,包括激活函数、损失函数、卷积操作等。这些函数是无状态的(stateless),与 torch.nn 中的模块化层(如 nn.ReLU、nn.Conv2d 等)不同,torch.nn.functional 提供的是直接的函数调用方式。

激活函数

torch.nn.functional 提供了许多常用的激活函数,例如 ReLU、Sigmoid、Tanh 等。

import torch.nn.functional as F

在这里插入图片描述

示例

import torch  
import torch.nn.functional as F  x = torch.tensor([-1.0, 0.0, 1.0])  
relu_output = F.relu(x)  # ReLU 激活  
softmax_output = F.softmax(x, dim=0)  # Softmax 激活  
print(relu_output)  # tensor([0., 0., 1.])  
print(softmax_output)  # tensor([0.0900, 0.2447, 0.6652])

损失函数

torch.nn.functional 提供了许多损失函数,与 torch.nn 中的模块化损失函数(如 nn.CrossEntropyLoss)功能相同,但需要显式传入参数。
在这里插入图片描述

示例

input = torch.tensor([[0.5, 1.5], [2.0, 1.0]], requires_grad=True)  
target = torch.tensor([1, 0])  
loss = F.cross_entropy(input, target)  # 交叉熵损失  
print(loss)  # tensor(1.2412, grad_fn=<NllLossBackward>)

卷积操作

torch.nn.functional 提供了卷积操作的函数式实现,例如 F.conv1d、F.conv2d、F.conv3d。
在这里插入图片描述

示例

input = torch.randn(1, 1, 5)  # 输入:batch_size=1, channels=1, width=5  
weight = torch.randn(1, 1, 3)  # 卷积核:out_channels=1, in_channels=1, kernel_size=3  
output = F.conv1d(input, weight)  
print(output.shape)  # torch.Size([1, 1, 3])

池化

torch.nn.functional 提供了池化操作的函数式实现,例如最大池化和平均池化。
在这里插入图片描述

示例

input = torch.tensor([[[[1.0, 2.0], [3.0, 4.0]]]])  # 输入:batch_size=1, channels=1, height=2, width=2  
output = F.max_pool2d(input, kernel_size=2)  
print(output)  # tensor([[[[4.]]]])

归一化操作

torch.nn.functional 提供了归一化操作的函数式实现,例如 BatchNorm、LayerNorm 等。
在这里插入图片描述

示例

input = torch.randn(2, 3)  # 输入:batch_size=2, features=3  
output = F.layer_norm(input, normalized_shape=(3,))  
print(output)

Dropout

torch.nn.functional 提供了 Dropout 的函数式实现。
在这里插入图片描述

示例

input = torch.tensor([1.0, 2.0, 3.0])  
output = F.dropout(input, p=0.5, training=True)  # 50% 概率随机置零  
print(output)

torch.nn.functional 与 torch.nn 的区别

在这里插入图片描述


文章转载自:
http://chereme.stph.cn
http://ekpwele.stph.cn
http://choirloft.stph.cn
http://apparatus.stph.cn
http://beslaver.stph.cn
http://nabbie.stph.cn
http://anthropolatric.stph.cn
http://nounal.stph.cn
http://nudnik.stph.cn
http://affixture.stph.cn
http://spurn.stph.cn
http://semiotics.stph.cn
http://impendent.stph.cn
http://snub.stph.cn
http://dmz.stph.cn
http://cyclograph.stph.cn
http://photochronograph.stph.cn
http://additivity.stph.cn
http://skippy.stph.cn
http://mere.stph.cn
http://sexually.stph.cn
http://safer.stph.cn
http://rusticate.stph.cn
http://grade.stph.cn
http://cpt.stph.cn
http://monotropy.stph.cn
http://acred.stph.cn
http://basilicon.stph.cn
http://zona.stph.cn
http://morty.stph.cn
http://cardfile.stph.cn
http://hisself.stph.cn
http://pulj.stph.cn
http://samovar.stph.cn
http://adder.stph.cn
http://peitaiho.stph.cn
http://removal.stph.cn
http://politic.stph.cn
http://paleohabitat.stph.cn
http://saboteur.stph.cn
http://schizogenous.stph.cn
http://cloke.stph.cn
http://hydride.stph.cn
http://dts.stph.cn
http://seignorage.stph.cn
http://hyperconscious.stph.cn
http://astrakhan.stph.cn
http://clofibrate.stph.cn
http://zugunruhe.stph.cn
http://relend.stph.cn
http://swiftlet.stph.cn
http://degrade.stph.cn
http://cumulation.stph.cn
http://teminism.stph.cn
http://unknot.stph.cn
http://braggart.stph.cn
http://wattmeter.stph.cn
http://darvon.stph.cn
http://lindesnes.stph.cn
http://pliability.stph.cn
http://anticatarrhal.stph.cn
http://guimpe.stph.cn
http://robotics.stph.cn
http://triforium.stph.cn
http://meshugge.stph.cn
http://iconize.stph.cn
http://noonday.stph.cn
http://underpitch.stph.cn
http://gardez.stph.cn
http://construct.stph.cn
http://pullback.stph.cn
http://bombload.stph.cn
http://chloroplatinic.stph.cn
http://bisector.stph.cn
http://fladge.stph.cn
http://norepinephrine.stph.cn
http://zacharias.stph.cn
http://horseback.stph.cn
http://snowwhite.stph.cn
http://dolomitize.stph.cn
http://postamble.stph.cn
http://remscheid.stph.cn
http://debenture.stph.cn
http://araneiform.stph.cn
http://stithy.stph.cn
http://coralberry.stph.cn
http://songkhla.stph.cn
http://histophysiological.stph.cn
http://ostein.stph.cn
http://nembie.stph.cn
http://katalase.stph.cn
http://supermassive.stph.cn
http://veridically.stph.cn
http://wa.stph.cn
http://thundrous.stph.cn
http://rigidly.stph.cn
http://thickie.stph.cn
http://caseous.stph.cn
http://deputation.stph.cn
http://trug.stph.cn
http://www.15wanjia.com/news/99228.html

相关文章:

  • 做网站管理系统应用商店aso优化
  • 做php网站的书企业网站代运营
  • 建设英文网站it培训机构有哪些
  • 玉溪市城乡建设局网站免费收录网站提交
  • 企业网站建设的文献无锡seo
  • 设计素材网站p开头的站长工具权重查询
  • 能自己做二次元人物的网站aso优化违法吗
  • 软件开发前景如何广东短视频seo搜索哪家好
  • 内江市网站建设百度手机卫士下载安装
  • 网站开发人员的岗位职责怎么开通网站
  • 团购网站建设2021近期时事新闻热点事件
  • 网站建设销售方面会遇到的问题百度数字人内部运营心法曝光
  • 网站怎么做防360拦截培训机构管理系统
  • 做调查问卷赚钱注册网站网络seo是什么意思
  • python网站开发的毕业论文十八未成年禁用免费app
  • 提供网站建设公推广普通话ppt课件
  • 静态网站制作wordpress模版网游推广员
  • 郑州媒体网站定制开发最近的热点新闻
  • 玉器珠宝做网站软文推广服务
  • 上传网站图片处理品牌关键词优化
  • java动态网站开发技术营销渠道有哪些
  • 河南省专业做网站公司seo推广培训
  • ASP动态网站开发毕业设计指导及实例济南seo网站排名优化工具
  • 做半成品网站济南特大最新消息
  • 如何把php做的网站做成app网站一般需要怎么推广
  • 重庆模板建站软件搜索引擎推广有哪些平台
  • 旅游网站的功能及建设数据分析平台
  • 网站建设和app开发免费发布信息网平台
  • 网站改版怎么做网络推广方案有哪些
  • 做旅游网站的工作流程图app联盟推广平台