1 from keras.layers.core
import Layer
2 import theano.tensor
as T
6 def __init__(self, alpha=0.0001,k=1,beta=0.75,n=5, **kwargs):
13 def call(self, x, mask=None):
17 extra_channels = T.alloc(0., b, ch + 2*half_n, r, c)
18 input_sqr = T.set_subtensor(extra_channels[:, half_n:half_n+ch, :, :],input_sqr)
20 norm_alpha = self.
alpha / self.
n 21 for i
in range(self.
n):
22 scale += norm_alpha * input_sqr[:, i:i+ch, :, :]
23 scale = scale ** self.
beta 28 config = {
"alpha": self.
alpha,
33 return dict(list(base_config.items()) + list(config.items()))
39 super(PoolHelper, self).
__init__(**kwargs)
41 def call(self, x, mask=None):
46 base_config = super(PoolHelper, self).
get_config()
47 return dict(list(base_config.items()) + list(config.items()))
def call(self, x, mask=None)
def call(self, x, mask=None)
def __init__(self, kwargs)
def __init__(self, alpha=0.0001, k=1, beta=0.75, n=5, kwargs)