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

Weird code in batch normalization #1096

Open
WyldeCat opened this issue Jul 13, 2020 · 1 comment
Open

Weird code in batch normalization #1096

WyldeCat opened this issue Jul 13, 2020 · 1 comment

Comments

@WyldeCat
Copy link

New Issue Checklist

Issue Description

https://github.com/tensorlayer/tensorlayer/blob/master/tensorlayer/layers/normalization.py#L291

        if self.axes is None:
            self.axes = [i for i in range(len(inputs.shape)) if i != self.channel_axis]

If I understood correctly, the above code is calculating axes to get means and variances for the normalization.
But it looks weird to me because self.channel_axis can be -1. Shouldn't this change like this or something similar?

        if self.axes is None:
            self.axes = [i for i in range(len(inputs.shape)) if i != self.channel_axis]
            if self.channel_axis == -1:
                self.axes = self.axes[-1]
@Laicheng0830
Copy link
Member

Thanks! there is a problem with this code, we will fix it immediately.

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