当前位置:网站首页>Centralized record of experimental problems
Centralized record of experimental problems
2022-04-23 20:47:00 【NuerNuer】
1.torch.repeat and tf.tile
Both functions will tensor Repeat the number of times for a certain dimension of :
a_ = torch.repeat(a, [x,y,x]) #a It's three-dimensional tensor, Put it 1,2,3 Dimension difference repeat x, y, z Time
b_ = tf.tile(b, [c,d,e,f]) #b It's three-dimensional tensor, Put it 1,2,3,4 Dimension difference repeat a,b,c,d Time
2.torch.diagonal and tf.diag_part
Extract the main diagonal element of the tensor
#torch
x = torch.randn(4,4)
tensor([[ 8.4527e-01, 1.9236e+00, -6.9886e-01, -4.1077e-01],
[-1.4905e+00, 2.8126e-01, 9.9094e-02, -2.0024e-03],
[-6.0617e-01, 1.0577e+00, -7.8548e-01, 2.0802e+00],
[-7.9660e-01, 1.2871e+00, -3.5069e-01, -1.5513e+00]])
torch.diagonal(x)
# tensor([ 0.8453, 0.2813, -0.7855, -1.5513])
#tensorflow
a = tf.diag_part(b)
# To be continued 🤪
版权声明
本文为[NuerNuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210545522903.html
边栏推荐
- LeetCode 1351、统计有序矩阵中的负数
- Minecraft 1.12.2模组开发(四十三) 自定义盾牌(Shield)
- Cmake project under vs2019: calculating binocular parallax using elas method
- Bash script learning -- for loop traversal
- Introduction to intrusion detection data set
- 启牛学堂有用吗,推荐的证券账户是否安全
- 学会打字后的思考
- Addition, deletion, modification and query of MySQL advanced table
- An error occurs when the addressable assets system project is packaged. Runtimedata is null
- 常用60类图表使用场景、制作工具推荐
猜你喜欢
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
中创存储|想要一个好用的分布式存储云盘,到底该怎么选
Commande dos pour la pénétration de l'Intranet
PHP的Laravel与Composer部署项目时常见问题
Common problems in deploying projects with laravel and composer for PHP
高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
Come in and teach you how to solve the problem of port occupation
JS arrow function user and processing method of converting arrow function into ordinary function
On the three paradigms of database design
Write table of MySQL Foundation (create table)
随机推荐
Syntaxerror: unexpected token r in JSON at position 0
Opencv reports an error. Expected PTR < CV:: UMAT > for argument '% s'‘
MySQL基础之写表(创建表)
100天拿下11K,转岗测试的超全学习指南
Factory mode
Fastdfs思维导图
setInterval、setTimeout、requestAnimationFrame
IOT 设计与开发
GO語言開發天天生鮮項目第三天 案例-新聞發布系統二
LeetCode 20、有效的括号
Syntax Error: TypeError: this. getOptions is not a function
go slice
Bash script learning -- for loop traversal
居家第二十三天的午饭
【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
LeetCode 1351、统计有序矩阵中的负数
电脑越用越慢怎么办?文件误删除恢复方法
Deep analysis of C language function
41. 缺失的第一个正数
中创存储|想要一个好用的分布式存储云盘,到底该怎么选