TensorLayer icon indicating copy to clipboard operation
TensorLayer copied to clipboard

Weird code in batch normalization

Open WyldeCat opened this issue 5 years ago • 1 comments

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]

WyldeCat avatar Jul 13 '20 02:07 WyldeCat

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

Laicheng0830 avatar Oct 10 '20 07:10 Laicheng0830