Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A reshape problem in InvConvNear #46

Open
shahuzi opened this issue Dec 4, 2020 · 2 comments
Open

A reshape problem in InvConvNear #46

shahuzi opened this issue Dec 4, 2020 · 2 comments

Comments

@shahuzi
Copy link

shahuzi commented Dec 4, 2020

Hi, @jaywalnut310 。I'm trying to understand the glow-tts by reading the code. And I am a little bit confused about this piece of code in InvConvNear。

glow-tts/modules.py

Lines 214 to 215 in 13e9976

x = x.view(b, 2, c // self.n_split, self.n_split // 2, t)
x = x.permute(0, 1, 3, 2, 4).contiguous().view(b, self.n_split, c // self.n_split, t)

So if the purpose is reshape the input x from [b,c,t] to [b, self.n_split, c // self.n_split, t],what's the purpose of the L214?

@shahuzi
Copy link
Author

shahuzi commented Dec 6, 2020

I know the purpose of

x = x.view(b, 2, c // self.n_split, self.n_split // 2, t)

is some kind of shuffle channel now, but I still not understand why this step is required.

@bear-boy
Copy link

I know the purpose of

x = x.view(b, 2, c // self.n_split, self.n_split // 2, t)

is some kind of shuffle channel now, but I still not understand why this step is required.

对,这是一种channel shuffle的操作。至于为什么需要channel shuffle,其实作者论文中有提及:To allow channel mixing in each group, the same number of channels are extracted from one half of the feature map separated by coupling layers and
the other half, respectively。具体来说,就是因为glow-tts里Inverse 11 conv是分组卷积的形式,失去了原本glow模型中Inverse 11 conv做channel shuffle的功能,所以这里需要“手动”做channel shuffle,把affine coupling中保持不变的一部分和参与运算的一部分在channel维上重组,部分的实现原本glow中Inverse 1*1 conv的功能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants