From 6715234a579dbeaa55d0ba4a4718191127ee0f6f Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Fri, 9 Oct 2020 15:14:16 +0800 Subject: [PATCH 1/2] fix bn --- tensorlayer/layers/normalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorlayer/layers/normalization.py b/tensorlayer/layers/normalization.py index 7df44c2e4..1cf3deed8 100644 --- a/tensorlayer/layers/normalization.py +++ b/tensorlayer/layers/normalization.py @@ -226,7 +226,6 @@ def __init__( self.moving_var_init = moving_var_init self.num_features = num_features - self.channel_axis = -1 if data_format == 'channels_last' else 1 self.axes = None if num_features is not None: @@ -288,6 +287,7 @@ def build(self, inputs_shape): def forward(self, inputs): self._check_input_shape(inputs) + self.channel_axis = len(inputs.shape)-1 if self.data_format == 'channels_last' else 1 if self.axes is None: self.axes = [i for i in range(len(inputs.shape)) if i != self.channel_axis] From 516c22c36c80c11409d68f147aefee5447837cc0 Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Sat, 10 Oct 2020 09:21:35 +0800 Subject: [PATCH 2/2] yapf --- tensorlayer/layers/normalization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorlayer/layers/normalization.py b/tensorlayer/layers/normalization.py index 1cf3deed8..161d6e018 100644 --- a/tensorlayer/layers/normalization.py +++ b/tensorlayer/layers/normalization.py @@ -287,7 +287,7 @@ def build(self, inputs_shape): def forward(self, inputs): self._check_input_shape(inputs) - self.channel_axis = len(inputs.shape)-1 if self.data_format == 'channels_last' else 1 + self.channel_axis = len(inputs.shape) - 1 if self.data_format == 'channels_last' else 1 if self.axes is None: self.axes = [i for i in range(len(inputs.shape)) if i != self.channel_axis]