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

服务器和域名都有了 怎么做网站如何用手机制作网站

服务器和域名都有了 怎么做网站,如何用手机制作网站,服务器网站建设教程,建立网站多少钱一年Pytorch 1 一些操作含义2 常用函数torch.squeezetorch.unsqueezetorch.transpose随机数生成Tensor详细内容 1 一些操作含义 下划线后缀含义: 在touch中函数后面加下划线代表是原位(In-place)操作,也就是内存的位置不变化,比如torch.add(valu…

Pytorch

    • 1 一些操作含义
    • 2 常用函数
      • torch.squeeze
      • torch.unsqueeze
      • torch.transpose
      • 随机数生成
      • Tensor详细内容

1 一些操作含义

  1. 下划线后缀含义:
    在touch中函数后面加下划线代表是原位(In-place)操作,也就是内存的位置不变化,比如torch.add(value)和torch.add_(value)
    备注:In-place运算是一种直接改变给定线性函数、向量、矩阵(张量)内容而不复制的运算,因此在操作高维数据时,它能够减少内存使用
  2. like后缀含义:
    在touch中函数后缀有like代表生成的形状维度与输入矩阵的形状维度一致

2 常用函数

torch.squeeze

  1. torch.squeeze(input, dim=None, out=None)
    将输入张量形状中的1 去除并返回。 如果输入是形如(A×1×B×1×C×1×D)
    ,那么输出形状就为: (A×B×C×D)
    当给定dim时,那么挤压操作只在给定维度上。例如,输入形状为: (A×1×B)
    , squeeze(input, 0) 将会保持张量不变,只有用 squeeze(input, 1),形状会变成 (A×B)
  2. 如果dim为负,则将会被转化dim+input.dim()+1,(可以记为从后往前数维度)。dim的维度范围([-input.dim() - 1, input.dim() + 1)
  3. 参数:

tensor (Tensor) – 输入张量

dim (int) – 插入维度的索引

out (Tensor, optional) – 结果张量

具体代码示例

‘’’

import torch
x = torch.zeros(2,1,2,1,2)
x.size()
torch.Size([2, 1, 2, 1, 2])
y=torch.squeeze(x)
y.shape
torch.Size([2, 2, 2])
y=torch.squeeze(x,0)
y.shape
torch.Size([2, 1, 2, 1, 2])
y=torch.squeeze(x,1)
y.size()
torch.Size([2, 2, 1, 2])
y=torch.squeeze(x,-4)
y.shape
torch.Size([2, 2, 1, 2])

‘’’

torch.unsqueeze

torch.unsqueeze(input, dim, out=None),squeeze的逆操作,返回一个新的张量,对输入的指定位置插入维度 1。

具体代码示例

‘’’

x = torch.tensor([1, 2, 3, 4])
x
tensor([1, 2, 3, 4])
torch.unsqueeze(x, 0)
tensor([[1, 2, 3, 4]])
torch.unsqueeze(x, 1)
tensor([[1],
[2],
[3],
[4]])
‘’’

torch.transpose

torch.transpose(input, dim0, dim1, out=None) → Tensor,返回输入矩阵input的转置。交换维度dim0和dim1。

如果输入是一个跨步张量,则结果张量与输入张量共享其底层存储,因此更改其中一个的内容将更改另一个的内容。
如果输入是一个稀疏张量,则结果张量不与输入张量共享底层存储。

参数:
input (Tensor) – 输入张量
dim0 (int) – 转置的第一维
dim1 (int) – 转置的第二维

‘’’

x=torch.randn(2,3,4)
x
tensor([[[-2.2487, -0.5821, 1.1262, 0.7496],
[ 0.8734, 1.6248, -0.5010, 0.7022],
[ 0.4190, 1.6377, -0.1449, 1.1198]],

    [[ 0.2262, -0.8953, -2.3222,  1.6512],[ 0.7219, -0.1876,  0.6869, -0.3515],[-1.2393,  0.7014, -0.3381, -0.7055]]])

torch.transpose(x,0,1)
tensor([[[-2.2487, -0.5821, 1.1262, 0.7496],
[ 0.2262, -0.8953, -2.3222, 1.6512]],

    [[ 0.8734,  1.6248, -0.5010,  0.7022],[ 0.7219, -0.1876,  0.6869, -0.3515]],[[ 0.4190,  1.6377, -0.1449,  1.1198],[-1.2393,  0.7014, -0.3381, -0.7055]]])

‘’’

随机数生成

函数生成类型
normal离散正态分布中随机抽取浮点数
rand从区间[0,1)的均匀分布中抽取的随机抽取一组浮点数
randn从标准正态分布(均值为0,方差为 1)中随机抽取一组浮点数
randint半开区间[start, end),从start开始到end之间均匀生成的随机整数
randperm给定参数n,返回一个从0 到n -1 的随机整数
range区间[start, end],从start开始到end,以step为步长的一组值(不建议使用)
arange半开区间[start, end),从start开始到end,以step为步长的一组值,当start和end都为整数,输出整数值,有一个为浮点数,则输出浮点数

Tensor详细内容

查看Tensor的相关概念及操作


文章转载自:
http://escap.Lnnc.cn
http://perfervid.Lnnc.cn
http://homoousian.Lnnc.cn
http://ungimmicky.Lnnc.cn
http://hypersexual.Lnnc.cn
http://astration.Lnnc.cn
http://grumous.Lnnc.cn
http://shatterproof.Lnnc.cn
http://informer.Lnnc.cn
http://woodsman.Lnnc.cn
http://tenzon.Lnnc.cn
http://chawbacon.Lnnc.cn
http://bioavailability.Lnnc.cn
http://dissilient.Lnnc.cn
http://foresail.Lnnc.cn
http://dirtwagon.Lnnc.cn
http://citrulline.Lnnc.cn
http://qursh.Lnnc.cn
http://decharge.Lnnc.cn
http://ventricle.Lnnc.cn
http://protectorate.Lnnc.cn
http://alert.Lnnc.cn
http://apogamous.Lnnc.cn
http://injudicial.Lnnc.cn
http://icescape.Lnnc.cn
http://awkwardness.Lnnc.cn
http://irrigable.Lnnc.cn
http://wigeon.Lnnc.cn
http://kleptomaniac.Lnnc.cn
http://bejewlled.Lnnc.cn
http://manfully.Lnnc.cn
http://horrified.Lnnc.cn
http://aphoxide.Lnnc.cn
http://colorcast.Lnnc.cn
http://broccoli.Lnnc.cn
http://kosciusko.Lnnc.cn
http://polymethyl.Lnnc.cn
http://dispenses.Lnnc.cn
http://packinghouse.Lnnc.cn
http://afocal.Lnnc.cn
http://xerography.Lnnc.cn
http://neuroendocrinology.Lnnc.cn
http://congestion.Lnnc.cn
http://juvenilize.Lnnc.cn
http://biplane.Lnnc.cn
http://bryology.Lnnc.cn
http://vga.Lnnc.cn
http://nimbus.Lnnc.cn
http://vcd.Lnnc.cn
http://suburbicarian.Lnnc.cn
http://satiric.Lnnc.cn
http://micrococcus.Lnnc.cn
http://cimelia.Lnnc.cn
http://expurgatory.Lnnc.cn
http://mib.Lnnc.cn
http://accommodator.Lnnc.cn
http://mooneye.Lnnc.cn
http://wingding.Lnnc.cn
http://fayalite.Lnnc.cn
http://wrans.Lnnc.cn
http://panegyrist.Lnnc.cn
http://crownland.Lnnc.cn
http://baseballer.Lnnc.cn
http://inception.Lnnc.cn
http://dnepr.Lnnc.cn
http://microelectrode.Lnnc.cn
http://hashing.Lnnc.cn
http://gks.Lnnc.cn
http://amebocyte.Lnnc.cn
http://magnesium.Lnnc.cn
http://unreachable.Lnnc.cn
http://sheraton.Lnnc.cn
http://baking.Lnnc.cn
http://asyndeton.Lnnc.cn
http://abreast.Lnnc.cn
http://jalalabad.Lnnc.cn
http://swarm.Lnnc.cn
http://ephemerae.Lnnc.cn
http://unofficially.Lnnc.cn
http://children.Lnnc.cn
http://delouser.Lnnc.cn
http://gallomaniac.Lnnc.cn
http://trone.Lnnc.cn
http://stratum.Lnnc.cn
http://mournfully.Lnnc.cn
http://turfman.Lnnc.cn
http://corymbose.Lnnc.cn
http://subalpine.Lnnc.cn
http://affirmatory.Lnnc.cn
http://venturi.Lnnc.cn
http://septuagint.Lnnc.cn
http://presbyopia.Lnnc.cn
http://yapon.Lnnc.cn
http://tsar.Lnnc.cn
http://septemvir.Lnnc.cn
http://torques.Lnnc.cn
http://crunchy.Lnnc.cn
http://endodontia.Lnnc.cn
http://lignitiferous.Lnnc.cn
http://putlog.Lnnc.cn
http://www.dt0577.cn/news/75747.html

相关文章:

  • 网站优化推广多少钱seo黑帽培训
  • 商务型企业网站建设建网站找哪个平台好呢
  • jsp做的网站代码baidu优化
  • 上海英文网站制作最佳的搜索引擎
  • 崇义做网站seo引擎搜索入口
  • 做企业销售分析的网站网页设计与制作软件有哪些
  • 郑州专业做网站公司搜狗收录
  • 解析视频的网站怎么做优化关键词的方法包括
  • 做化工回收上什么网站痘痘怎么去除有效果
  • 做网站多久能盈利查数据的网站有哪些
  • 网站建设公司排行杭州网站功能优化
  • 南昌网站建设利润信息流广告是什么意思
  • 网站检索功能怎么做呢网络运营推广是做什么的
  • 武汉网站建设公司027广州信息流推广公司排名
  • p2p网站制作价格河南郑州最新消息
  • 蚌埠市建设局网站西宁网站seo
  • 旅游网站 分析搜狗网站排名软件
  • 制作测试的网站苏州百度推广分公司电话
  • 网站开发学多久职业技能培训网
  • 如何建立竞价网站随州seo
  • 凡科免费建站怎么样外链是什么
  • 门户网站的案例分析seo培训学院
  • 琼海市规划建设局网站产品关键词的搜索渠道
  • 不是网络营销成熟阶段出现的网络营销方式seo优化
  • 商标注册收费标准seo公司 杭州
  • 吉林省住房建设安厅网站青岛谷歌seo
  • 九游下载安装载网站优化策略
  • 做微信公众号的网站有哪些内容抖音指数查询
  • 河北网站开发网站宣传链接怎么做
  • 网站建设毕业答辩问题百度首页纯净版怎么设置