Ejemplo n.º 1
0
 def call(self, x, mask=None):
     if self.test_phase_noise:
         return x+self.get_noise(x)
     else:
         return K.in_train_phase(x+self.get_noise(x), x)
Ejemplo n.º 2
0
 def get_mi_loss(self):
     if not hasattr(self, 'layer'):
         raise Exception('Need to call `set_layer` on ActivityRegularizer instance before calling the instance.')
     return K.in_train_phase(self.alpha * self.micomputer.get_mi(), 0)