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

苏州做网站好的公司忘记网站后台密码

苏州做网站好的公司,忘记网站后台密码,公司网站建设会计处理,金网科技对数据的维度进行压缩 使用方式:torch.squeeze(input, dimNone, outNone) 将输入张量形状中的1 去除并返回。 如果输入是形如(A1B1C1D),那么输出形状就为: (ABCD) import torch x torch.rand(2, 1, 1, 3, 1, 4) print(x) print(x.shape) …

对数据的维度进行压缩

使用方式:torch.squeeze(input, dim=None, out=None)

将输入张量形状中的1 去除并返回。 如果输入是形如(A×1×B×1×C×1×D),那么输出形状就为: (A×B×C×D)

import torch
x = torch.rand(2, 1, 1, 3, 1, 4)
print('=======x=========')
print(x.shape)
out_1 = torch.squeeze(x)
print('=======out_1=========')
print(out_1.shape)
# =======x=========
# torch.Size([2, 1, 1, 3, 1, 4])
# =======out_1=========
# torch.Size([2, 3, 4])

当给定dim时,那么挤压操作只在给定维度上。例如,输入形状为: (A×1×B), squeeze(input, 0) 将会保持张量不变,只有用 squeeze(input, 1),形状会变成 (A×B)。

注意:

如果dim指定的维度的值为1

第一种情况

import torch
x = torch.rand(2,1,1,3,1,4)
print('=======x=========')
print(x.shape)
out_1 = torch.squeeze(x, dim=1)
print('=======out_1=========')
print(out_1.shape)
# =======x=========
# torch.Size([2, 1, 1, 3, 1, 4])
# =======out_1=========
# torch.Size([2, 1, 3, 1, 4])
import torch
x = torch.rand(2,1,3,1,4)
print('=======x=========')
print(x.shape)
out_1 = torch.squeeze(x, dim=1)
print('=======out_1=========')
print(out_1.shape)
# =======x=========
# torch.Size([2, 1, 3, 1, 4])
# =======out_1=========
# torch.Size([2, 3, 1, 4])

第二种情况

x = torch.rand(1,2,1,1,3,1,4)
print('=======x=========')
print(x.shape)
out_2 = torch.squeeze(x, dim=1)
print('=======out_2=========')
print(out_2.shape)
# =======x=========
# torch.Size([1, 2, 1, 1, 3, 1, 4])
# =======out_2=========
# torch.Size([1, 2, 1, 1, 3, 1, 4])

第三种情况

x = torch.rand(1,1,2,1,1,3,1,4)
print('=======x=========')
print(x.shape)
out_3 = torch.squeeze(x, dim=1)
print('=======out_3=========')
print(out_3.shape)
# =======x=========
# # torch.Size([1, 1, 2, 1, 1, 3, 1, 4])
# # =======out_3=========
# # torch.Size([1, 2, 1, 1, 3, 1, 4])

如果dim指定的维度的值为-1

第一种情况 如果dim指定的维度的值为-1

import torchx = torch.rand(2,1,1,3,1,4)
print('=======x=========')
print(x.shape)
out_1 = torch.squeeze(x, dim=-1)
print('=======out_1=========')
print(out_1.shape)
# =======x=========
# torch.Size([2, 1, 1, 3, 1, 4])
# =======out_1=========
# torch.Size([2, 1, 1, 3, 1, 4])

第二种情况 如果dim指定的维度的值为-1

x = torch.rand(2,1,1,3,1,4,1)
print('=======x=========')
print(x.shape)
out_2 = torch.squeeze(x, dim=-1)
print('=======out_2=========')
print(out_2.shape)
# =======x=========
# torch.Size([2, 1, 1, 3, 1, 4, 1])
# =======out_2=========
# torch.Size([2, 1, 1, 3, 1, 4])

第三种情况 如果dim指定的维度的值为-1

x = torch.rand(2,1,1,3,1,4,1,1)
print('=======x=========')
print(x.shape)
out_3 = torch.squeeze(x, dim=-1)
print('=======out_3=========')
print(out_3.shape)
# =======x=========
# torch.Size([2, 1, 1, 3, 1, 4, 1, 1])
# =======out_3=========
# torch.Size([2, 1, 1, 3, 1, 4, 1])

如果dim指定的维度的值为2

import torchx = torch.rand(2,1,3,1,4)
print('=======x=========')
print(x.shape)
out_1 = torch.squeeze(x, dim=2)
print('=======out_1=========')
print(out_1.shape)
# =======x=========
# torch.Size([2, 1, 3, 1, 4])
# =======out_1=========
# torch.Size([2, 1, 3, 1, 4])x = torch.rand(2,1,1,3,1,4)
print('=======x=========')
print(x.shape)
out_2 = torch.squeeze(x, dim=2)
print('=======out_2=========')
print(out_2.shape)
# =======x=========
# torch.Size([2, 1, 1, 3, 1, 4])
# =======out_2=========
# torch.Size([2, 1, 3, 1, 4])x = torch.rand(1,2,1,1,3,1,1,4)
print('=======x=========')
print(x.shape)
out_3 = torch.squeeze(x, dim=2)
print('=======out_3=========')
print(out_3.shape)
# =======x=========
# torch.Size([1, 2, 1, 1, 3, 1, 1, 4])
# =======out_3=========
# torch.Size([1, 2, 1, 3, 1, 1, 4])

http://www.yayakq.cn/news/419585/

相关文章:

  • 河南城乡住房和建设厅网站搜索引擎优化的概念
  • 检测网站开发语言工具最贵网站建设多少钱
  • 公司招聘网站 哪个部门做济南做公司网站需要多少钱
  • 挂机宝 可以做网站深圳软件开发有限公司
  • 自己怎么申请网站空间甘肃锦华建设集团网站
  • 个人网站备案 名称宣讲家网站两学一做心得体会
  • 蓝色响应式机械类网站wordpress get图片
  • 登陆国外的网站要这么做移动端开发语言
  • 腾讯云网站制作教程wordpress速成
  • 触摸网站手机软文投放平台有哪些
  • 关于进行网站建设费用的请示企业网络推广情况介绍
  • 浙江网站建设公司排名会计常用的三个软件
  • 注册网站会员违法.tel域名不可以做网站域名吗
  • 有关网站升级建设的申请书兴义网站开发公司
  • 郑州快速建站公司网站需要哪些费用
  • 做网站公司关键词简述企业网站的建设流程
  • wordpress 备份恢复郑州网站优化公司电话
  • 建设网站需要备案么wordpress链接打不开
  • 阜阳手机网站制作微信扫码下单小程序怎么做
  • 专门写文章的网站那些网站可以做公司的推广
  • 白沟17网站一起做网店机械 网站源码
  • vip影院自助建站系统关键词推广效果分析
  • 建站网址什么意思建筑网站搜图
  • 创业网站建设方案项目书视频类网站备案
  • 做旅游网站选什么空间互联网运营管理
  • 宁波网站seo诊断工具国家时事新闻2020最新
  • 做技术分享网站有哪些哪个装修公司比较好
  • 网站建设项目背景网站后台的网址忘记了
  • 游戏网站搭建需要多少钱哪里ui培训班好
  • 石家庄公司建站深圳平台网站建设