当前位置:网站首页>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
边栏推荐
- Minecraft 1.12.2模组开发(四十三) 自定义盾牌(Shield)
- LeetCode 116. 填充每个节点的下一个右侧节点指针
- LeetCode 116. Populate the next right node pointer for each node
- Addition, deletion, modification and query of advanced MySQL data (DML)
- 41. 缺失的第一个正数
- Syntaxerror: unexpected token r in JSON at position 0
- Selenium displays webdriverwait
- Matlab: psychtoolbox installation
- 2021-09-02 unity project uses rider to build hot change project failure record of ilruntime
- Selenium 显示等待WebDriverWait
猜你喜欢
Flex layout
[matlab 2016 use mex command to find editor visual studio 2019]
Leetcode 74. Search two-dimensional matrix
The construction and use of Fortress machine and springboard machine jumpserver are detailed in pictures and texts
JS arrow function user and processing method of converting arrow function into ordinary function
Preliminary understanding of cache elimination algorithm (LRU and LFU)
Leetcode 994, rotten orange
MySQL basic collection
go interface
LeetCode 116. 填充每个节点的下一个右侧节点指针
随机推荐
How many hacking methods do you know?
41. 缺失的第一个正数
PHP的Laravel与Composer部署项目时常见问题
Bracket matching -- [implementation of one-dimensional array]
Reentrant function
Use of node template engine
Awk print special characters
unity 功能扩展
A login and exit component based on token
bounding box iou
On the three paradigms of database design
vulnhub DC:1渗透笔记
Introduction to intrusion detection data set
Common problems in deploying projects with laravel and composer for PHP
What about laptop Caton? Teach you to reinstall the system with one click to "revive" the computer
Matlab: psychtoolbox installation
Addition, deletion, modification and query of advanced MySQL data (DML)
MySQL基础合集
UKFslam
Mysql database common sense storage engine