Beispiel #1
0
 def _batchnorm_scaling_terms_only(self, inp):
     return B.batch_normalization(inputs=inp,
                                  gamma=self.reshaped_gamma,
                                  beta=0.0,
                                  mean=0.0,
                                  std=self.reshaped_std,
                                  epsilon=self.epsilon)
Beispiel #2
0
 def _build_activation_vars(self, input_act_vars):
     new_shape = [(1 if (i != self.axis\
                     and i != (len(self._shape)+self.axis)) #neg self.axis
                     else self._shape[i])
                    for i in range(len(self._shape))]
     self.reshaped_mean = self.mean.reshape(new_shape)
     self.reshaped_std = self.std.reshape(new_shape)
     self.reshaped_gamma = self.gamma.reshape(new_shape)
     self.reshaped_beta = self.beta.reshape(new_shape)
     return B.batch_normalization(inputs=input_act_vars,
                                  gamma=self.reshaped_gamma,
                                  beta=self.reshaped_beta,
                                  mean=self.reshaped_mean,
                                  std=self.reshaped_std,
                                  epsilon=self.epsilon)