예제 #1
0
파일: extra_layers.py 프로젝트: tsnef/keras
 def get_output(self, train):
     import theano.tensor as T
     X = self.get_input(train)
     input_dim = X.shape
     half_n = self.n // 2
     input_sqr = K.sqr(X)
     b, ch, r, c = input_dim
     extra_channels = T.alloc(0., b, ch + 2 * half_n, r, c)
     input_sqr = K.set_subtensor(
         extra_channels[:, half_n:half_n + ch, :, :], input_sqr)
     scale = self.k
     norm_alpha = self.alpha / self.n
     for i in range(self.n):
         scale += norm_alpha * input_sqr[:, i:i + ch, :, :]
     scale = scale**self.beta
     return X / scale
예제 #2
0
def sum_mse(y_true, y_pred):
    return K.sqr(y_true - y_pred).sum()
예제 #3
0
 def func(y_true, y_pred):
     return K.sum(K.exp(-K.sqr(y_true - y_pred)/sigma))
예제 #4
0
        def loss(x):
            x_rec, _, _ = self.mcmc_chain(x, nb_gibbs_steps)

            return K.mean(K.sqr(x - x_rec))
예제 #5
0
def sum_mse(y_true, y_pred):
    return K.sqr(y_true - y_pred).sum()
예제 #6
0
 def func(y_true, y_pred):
     return -K.mean(K.exp(-K.sqr(y_true - y_pred) / sigma), -1)
예제 #7
0
 def func(y_true, y_pred):
     return -K.mean(K.exp(-K.sqr(y_true - y_pred)/sigma), -1)
예제 #8
0
        def loss(x):
            x_rec, _, _ = self.mcmc_chain(x, nb_gibbs_steps)

            return K.mean(K.sqr(x - x_rec))