1 先看看官方中英文doc:
1.1 permute(dims)
将tensor的维度换位。
Call of duty black ops sound files download. 参数: - __dims__ (int .*) - 换位顺序 https://cooltfile611.weebly.com/888-casino-no-deposit-bonus.html.
例:
Numpy.transpose function. The transpose function is used to permute the dimensions of an array. Syntax: numpy.transpose(a, axes=None) Version: 1.15.0 Parameter. Well, version 2.X for the most part was great. Transcoded fast, and more often than not well. I pretty much only go from.TS files to.MP4 and I've done 5-6 with the new version 3 - first 3.0.1 all they way up to 3.0.4 and all of them resulted in nothing but an hour and a half black screen with no sound.
1.2 permute(*dims) → Tensor
Permute the dimensions of this tensor.
Parameters: *dims (int.) – The desired ordering of dimensions
Example:
2 pytorch permute的使用
permute函数功能还是比较简单的,下面主要介绍几个细节点:
2.1 transpose与permute的异同
Tensor.permute(a,b,c,d, .):permute函数可以对任意高维矩阵进行转置,但没有 torch.permute() 这个调用方式, 只能 Tensor.permute():
torch.transpose(Tensor, a,b):transpose只能操作2D矩阵的转置,有两种调用方式;
另:连续使用transpose也可实现permute的效果:
从以上操作中可知,permute相当于可以同时操作于tensor的若干维度,transpose只能同时作用于tensor的两个维度; https://bestsfiles787.weebly.com/elmedia-player-go-7-2-10.html.
2.2 permute函数与contiguous、view函数之关联
contiguous:view只能作用在contiguous的variable上,如果在view之前调用了transpose、permute等,就需要调用contiguous()来返回一个contiguous copy;
一种可能的解释是:有些tensor并不是占用一整块内存,而是由不同的数据块组成,而tensor的view()操作依赖于内存是整块的,这时只需要执行contiguous()这个函数,把tensor变成在内存中连续分布的形式; Day one 2 5 5 download free.
判断ternsor是否为contiguous,可以调用torch.Tensor.is_contiguous()函数:
另:在pytorch的最新版本0.4版本中,增加了torch.reshape(),与 numpy.reshape() 的功能类似,大致相当于 tensor.contiguous().view(),这样就省去了对tensor做view()变换前,调用contiguous()的麻烦;
3 permute与view函数功能demo
利用函数 permute(2,0,1) 可以把 Tensor([[[1,2,3],[4,5,6]]]) 转换成:
如果使用view(1,3,2) 可以得到:
5 参考
Last Updated on October 12, 2020 by
Permute is a versatile tool that allows you to convert video, audio and images files into different formats, increase volume, merge them and much more!
Video, audio and image files come in many different kinds and shapes, but sometimes you need a specific format since your iPad or DVD player won't play that video. That's what Permute is for!
Here are some key features:
– Beautiful UI – See what you are converting. Permute includes icon view that allows you to see thumbnails of whatever you are working with.
Permute 3 0 18
– Easy to Use – What could be easier? Drag & drop a file, select target format and go. That easy!
– Insanely Fast – Permute can utilize as much of your computer as possible to get stuff done ASAP.
– Versatile – Videos, audio, images – Permute can handle it all. Want to create a DVD? No problem, Permute can do that too. With Permute 3.2 or later, you can also convert images into text!
Permute 3 0 12
– Customizations – Customize the presets, or just that particular conversion. Increase volume, rotate video, change its resolution, flip it and so on!
What's new in Permute
Permute(0 3 1 2)
Permute(0 2 3 1).contiguous()
Looking for Older Versions? Check the Archive
- Details: