예제 #1
0
 def __init__(self, init_logvar, kdelayer, 
              regularize_mi_input=None, 
              init_alpha=1.0, 
              get_noise_input_func=None, 
              trainable=True,
              test_phase_noise=True,
              *kargs, **kwargs):
     self.supports_masking = True
     self.init_logvar = init_logvar
     #self.uses_learning_phase = True
     self.kdelayer = kdelayer
     self.get_noise_input_func = get_noise_input_func
     if regularize_mi_input is not None:
         self.mi_regularizer = MIRegularizer(MIComputer(get_noise_input_func(regularize_mi_input), kdelayer=kdelayer, noiselayer=self),
                                            alpha=init_alpha)
     else:
         self.mi_regularizer = None
     self.logvar = K.variable(0.0)
     #self.init_alpha = init_alpha
     #self.alpha = K.variable(0.0)
     
     self.is_trainable = trainable
     self.test_phase_noise = test_phase_noise
     
     super(GaussianNoise2, self).__init__(*kargs, **kwargs)
예제 #2
0
 def __init__(self, init_logvar):
     self.init_logvar = init_logvar
     self.logvar = K.variable(0.0)
     super(KDEParamLayer, self).__init__()
예제 #3
0
 def __init__(self, micomputer, alpha):
     super(MIRegularizer, self).__init__()
     self.micomputer = micomputer
     self.alpha = K.variable(alpha)