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

如何分析网站站长工具域名

如何分析网站,站长工具域名,营销网站外包,郑州网站建设 app开发文章目录 1. einops2. code3. pytorch 1. einops einops 主要是通过爱因斯坦标记法来处理张量矩阵的库,让矩阵处理上非常简单。 conda : conda install conda-forge::einopspython: 2. code import torch import torch.nn as nn import torch.nn.functional as…

文章目录

  • 1. einops
  • 2. code
  • 3. pytorch

1. einops

einops 主要是通过爱因斯坦标记法来处理张量矩阵的库,让矩阵处理上非常简单。

  • conda :
conda install conda-forge::einops
  • python:

2. code

import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, repeat, reducetorch.set_printoptions(precision=3, sci_mode=False)if __name__ == "__main__":run_code = 0x = torch.arange(96).reshape((2, 3, 4, 4)).to(torch.float32)print(f"x.shape={x.shape}")print(f"x=\n{x}")# 1. 转置x_torch_trans = x.transpose(1, 2)x_einops_trans = rearrange(x, 'b i w h -> b w i h')x_check_trans = torch.allclose(x_torch_trans, x_einops_trans)print(f"x_torch_trans is {x_check_trans} same with x_einops_trans")# 2. 变形x_torch_reshape = x.reshape(6, 4, 4)x_einops_reshape = rearrange(x, 'b i w h -> (b i) w h')x_check_reshape = torch.allclose(x_torch_reshape, x_einops_reshape)print(f"x_einops_reshape is {x_check_reshape} same with x_check_reshape")# 3. image2patchimage2patch = rearrange(x, 'b i (h1 p1) (w1 p2) -> b i (h1 w1) p1 p2', p1=2, p2=2)print(f"image2patch.shape={image2patch.shape}")print(f"image2patch=\n{image2patch}")image2patch2 = rearrange(image2patch, 'b i j h w -> b (i j) h w')print(f"image2patch2.shape={image2patch2.shape}")print(f"image2patch2=\n{image2patch2}")y = torch.arange(24).reshape((2, 3, 4)).to(torch.float32)y_einops_mean = reduce(y, 'b h w -> b h', 'mean')print(f"y=\n{y}")print(f"y_einops_mean=\n{y_einops_mean}")y_tensor = torch.arange(24).reshape(2, 2, 2, 3)y_list = [y_tensor, y_tensor, y_tensor]y_output = rearrange(y_list, 'n b i h w -> n b i h w')print(f"y_tensor=\n{y_tensor}")print(f"y_output=\n{y_output}")z_tensor = torch.arange(12).reshape(2, 2, 3).to(torch.float32)z_tensor_1 = rearrange(z_tensor, 'b h w -> b h w 1')print(f"z_tensor=\n{z_tensor}")print(f"z_tensor_1=\n{z_tensor_1}")z_tensor_2 = repeat(z_tensor_1, 'b h w 1 -> b h w 2')print(f"z_tensor_2=\n{z_tensor_2}")z_tensor_repeat = repeat(z_tensor, 'b h w -> b (2 h) (2 w)')print(f"z_tensor_repeat=\n{z_tensor_repeat}")
  • python:
x.shape=torch.Size([2, 3, 4, 4])
x=
tensor([[[[ 0.,  1.,  2.,  3.],[ 4.,  5.,  6.,  7.],[ 8.,  9., 10., 11.],[12., 13., 14., 15.]],[[16., 17., 18., 19.],[20., 21., 22., 23.],[24., 25., 26., 27.],[28., 29., 30., 31.]],[[32., 33., 34., 35.],[36., 37., 38., 39.],[40., 41., 42., 43.],[44., 45., 46., 47.]]],[[[48., 49., 50., 51.],[52., 53., 54., 55.],[56., 57., 58., 59.],[60., 61., 62., 63.]],[[64., 65., 66., 67.],[68., 69., 70., 71.],[72., 73., 74., 75.],[76., 77., 78., 79.]],[[80., 81., 82., 83.],[84., 85., 86., 87.],[88., 89., 90., 91.],[92., 93., 94., 95.]]]])
x_torch_trans is True same with x_einops_trans
x_einops_reshape is True same with x_check_reshape
image2patch.shape=torch.Size([2, 3, 4, 2, 2])
image2patch=
tensor([[[[[ 0.,  1.],[ 4.,  5.]],[[ 2.,  3.],[ 6.,  7.]],[[ 8.,  9.],[12., 13.]],[[10., 11.],[14., 15.]]],[[[16., 17.],[20., 21.]],[[18., 19.],[22., 23.]],[[24., 25.],[28., 29.]],[[26., 27.],[30., 31.]]],[[[32., 33.],[36., 37.]],[[34., 35.],[38., 39.]],[[40., 41.],[44., 45.]],[[42., 43.],[46., 47.]]]],[[[[48., 49.],[52., 53.]],[[50., 51.],[54., 55.]],[[56., 57.],[60., 61.]],[[58., 59.],[62., 63.]]],[[[64., 65.],[68., 69.]],[[66., 67.],[70., 71.]],[[72., 73.],[76., 77.]],[[74., 75.],[78., 79.]]],[[[80., 81.],[84., 85.]],[[82., 83.],[86., 87.]],[[88., 89.],[92., 93.]],[[90., 91.],[94., 95.]]]]])
image2patch2.shape=torch.Size([2, 12, 2, 2])
image2patch2=
tensor([[[[ 0.,  1.],[ 4.,  5.]],[[ 2.,  3.],[ 6.,  7.]],[[ 8.,  9.],[12., 13.]],[[10., 11.],[14., 15.]],[[16., 17.],[20., 21.]],[[18., 19.],[22., 23.]],[[24., 25.],[28., 29.]],[[26., 27.],[30., 31.]],[[32., 33.],[36., 37.]],[[34., 35.],[38., 39.]],[[40., 41.],[44., 45.]],[[42., 43.],[46., 47.]]],[[[48., 49.],[52., 53.]],[[50., 51.],[54., 55.]],[[56., 57.],[60., 61.]],[[58., 59.],[62., 63.]],[[64., 65.],[68., 69.]],[[66., 67.],[70., 71.]],[[72., 73.],[76., 77.]],[[74., 75.],[78., 79.]],[[80., 81.],[84., 85.]],[[82., 83.],[86., 87.]],[[88., 89.],[92., 93.]],[[90., 91.],[94., 95.]]]])
y=
tensor([[[ 0.,  1.,  2.,  3.],[ 4.,  5.,  6.,  7.],[ 8.,  9., 10., 11.]],[[12., 13., 14., 15.],[16., 17., 18., 19.],[20., 21., 22., 23.]]])
y_einops_mean=
tensor([[ 1.500,  5.500,  9.500],[13.500, 17.500, 21.500]])
y_tensor=
tensor([[[[ 0,  1,  2],[ 3,  4,  5]],[[ 6,  7,  8],[ 9, 10, 11]]],[[[12, 13, 14],[15, 16, 17]],[[18, 19, 20],[21, 22, 23]]]])
y_output=
tensor([[[[[ 0,  1,  2],[ 3,  4,  5]],[[ 6,  7,  8],[ 9, 10, 11]]],[[[12, 13, 14],[15, 16, 17]],[[18, 19, 20],[21, 22, 23]]]],[[[[ 0,  1,  2],[ 3,  4,  5]],[[ 6,  7,  8],[ 9, 10, 11]]],[[[12, 13, 14],[15, 16, 17]],[[18, 19, 20],[21, 22, 23]]]],[[[[ 0,  1,  2],[ 3,  4,  5]],[[ 6,  7,  8],[ 9, 10, 11]]],[[[12, 13, 14],[15, 16, 17]],[[18, 19, 20],[21, 22, 23]]]]])
z_tensor=
tensor([[[ 0.,  1.,  2.],[ 3.,  4.,  5.]],[[ 6.,  7.,  8.],[ 9., 10., 11.]]])
z_tensor_1=
tensor([[[[ 0.],[ 1.],[ 2.]],[[ 3.],[ 4.],[ 5.]]],[[[ 6.],[ 7.],[ 8.]],[[ 9.],[10.],[11.]]]])
z_tensor_2=
tensor([[[[ 0.,  0.],[ 1.,  1.],[ 2.,  2.]],[[ 3.,  3.],[ 4.,  4.],[ 5.,  5.]]],[[[ 6.,  6.],[ 7.,  7.],[ 8.,  8.]],[[ 9.,  9.],[10., 10.],[11., 11.]]]])
z_tensor_repeat=
tensor([[[ 0.,  1.,  2.,  0.,  1.,  2.],[ 3.,  4.,  5.,  3.,  4.,  5.],[ 0.,  1.,  2.,  0.,  1.,  2.],[ 3.,  4.,  5.,  3.,  4.,  5.]],[[ 6.,  7.,  8.,  6.,  7.,  8.],[ 9., 10., 11.,  9., 10., 11.],[ 6.,  7.,  8.,  6.,  7.,  8.],[ 9., 10., 11.,  9., 10., 11.]]])

3. pytorch

在这里插入图片描述

http://www.hkea.cn/news/673924/

相关文章:

  • 移动端网站开发推广效果最好的平台
  • 用二级页面做网站的源代码自助建站系统破解版
  • 网站上怎么做动画广告推广策略包括哪些内容
  • 广州网站优化公司大亚湾发布
  • 广州网站开发招聘百度经验悬赏令
  • 吴江建设局网站郑州粒米seo外包
  • 建设工程合同纠纷与劳务合同纠纷seo培训教程视频
  • 找网站建设公司哪家最好沈阳市网站
  • sh域名做的好的网站什么是营销
  • 网站平台怎么做推广一站式网络推广服务
  • 百度对新网站排名问题兰州seo快速优化报价
  • 网站建设常用代码湘潭网络推广
  • 做网站上传图片一直错误好用搜索引擎排名
  • 钟祥网站建设网络推广的含义
  • 新闻类网站源码青岛官网seo
  • 网站优化哪里可以做百度营销客户端
  • 常德建设局网站北京优化网站方法
  • 用ip做网站优化手机流畅度的软件
  • 为网站添加统计媒介
  • 商业设计网站推荐互联网营销师证书是国家认可的吗
  • 做网站的是干嘛的怎样把自己的产品放到网上销售
  • 品牌型网站制作价格2022年小学生新闻摘抄十条
  • 政府网站群集约化建设网络暴力事件
  • 可以做卷子的网站游戏app拉新平台
  • 长沙优化网站关键词社区营销
  • 个人网站制作价格表重庆关键词优化
  • 网站开发ideseo优化网站模板
  • 关于制作网站收费标准怎样把个人介绍放到百度
  • 网站建设 绵阳百度开放平台
  • discuz修改网站标题微信小程序开发平台