History and Etymology for permute Middle English, to exchange, from Anglo-French or Latin; Anglo-French permuter, from Latin permutare, from per- + mutare to change — more at mutable Learn More about permute Time Traveler for permute. Find the Number of Possibilities 9 permute 5. Evaluate 9P5 P 5 9 using the formula nPr = n! Subtract 5 5 from 9 9. 2.2 permute函数与contiguous、view函数之关联. Contiguous :view只能作用在contiguous的variable上,如果在view之前调用了transpose、permute等,就需要调用contiguous 来返回一个contiguous copy;. Permute is a quick image, audio, and video converter. You can use it for files of all formats because Permute can convert anything into anything (almost). For water to wine conversion you’d have to refer to other authorities, but media files can become whatever format you need them to. 接下来,说一下permute ,函数的参数为新的维度顺序,例如想交换第一维与第三维的index,则tensor.permute (2,1,0),同样举一个简单第二维与第三维的例子,.
Also found in: Thesaurus, Medical, Legal, Encyclopedia, Wikipedia.per·mute
(pər-myo͞ot′)tr.v.per·mut·ed,Permute Pytorch
per·mut·ing, per·mutespermute
(pəˈmjuːt) vb (tr)What Is The Mean Of A Permutation
per•mute
(pərˈmyut)v.t. -mut•ed, -mut•ing.
permute
Past participle: permuted
Gerund: permuting
Imperative |
---|
permute |
permute |
Present |
---|
I permute |
you permute |
he/she/it permutes |
we permute |
you permute |
they permute |
Preterite |
---|
I permuted |
you permuted |
he/she/it permuted |
we permuted |
you permuted |
they permuted |
Present Continuous |
---|
I am permuting |
you are permuting |
he/she/it is permuting |
we are permuting |
you are permuting |
they are permuting |
Present Perfect |
---|
I have permuted |
you have permuted |
he/she/it has permuted |
we have permuted |
you have permuted |
they have permuted |
Past Continuous |
---|
I was permuting |
you were permuting |
he/she/it was permuting |
we were permuting |
you were permuting |
they were permuting |
Past Perfect |
---|
I had permuted |
you had permuted |
he/she/it had permuted |
we had permuted |
you had permuted |
they had permuted |
Future |
---|
I will permute |
you will permute |
he/she/it will permute |
we will permute |
you will permute |
they will permute |
Future Perfect |
---|
I will have permuted |
you will have permuted |
he/she/it will have permuted |
we will have permuted |
you will have permuted |
they will have permuted |
Future Continuous |
---|
I will be permuting |
you will be permuting |
he/she/it will be permuting |
we will be permuting |
you will be permuting |
they will be permuting |
Present Perfect Continuous |
---|
I have been permuting |
you have been permuting |
he/she/it has been permuting |
we have been permuting |
you have been permuting |
they have been permuting |
Future Perfect Continuous |
---|
I will have been permuting |
you will have been permuting |
he/she/it will have been permuting |
we will have been permuting |
you will have been permuting |
they will have been permuting |
Past Perfect Continuous |
---|
I had been permuting |
you had been permuting |
he/she/it had been permuting |
we had been permuting |
you had been permuting |
they had been permuting |
Conditional |
---|
I would permute |
you would permute |
he/she/it would permute |
we would permute |
you would permute |
they would permute |
Past Conditional |
---|
I would have permuted |
you would have permuted |
he/she/it would have permuted |
we would have permuted |
you would have permuted |
they would have permuted |
Verb | 1. | permute - change the order or arrangement of; 'Dyslexics often transpose letters in a word' transpose, commute change by reversal, reverse, turn - change to the contrary; 'The trend was reversed'; 'the tides turned against him'; 'public opinion turned when it was revealed that the president had an affair with a White House intern' map, represent - to establish a mapping (of mathematical elements or sets) |
permute
Want to thank TFD for its existence? Tell a friend about us, add a link to this page, or visit the webmaster's page for free fun content.
Link to this page:
1 先看看官方中英文doc:
1.1 permute(dims)
将tensor的维度换位。
参数: - __dims__ (int ..*) - 换位顺序
例:
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的两个维度;
2.2 permute函数与contiguous、view函数之关联
contiguous:view只能作用在contiguous的variable上,如果在view之前调用了transpose、permute等,就需要调用contiguous()来返回一个contiguous copy;
一种可能的解释是:有些tensor并不是占用一整块内存,而是由不同的数据块组成,而tensor的view()操作依赖于内存是整块的,这时只需要执行contiguous()这个函数,把tensor变成在内存中连续分布的形式;
判断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 参考