def forward(self, inputtensor):
x = inputtensor[0]
input_shape = x.shape
ch = input_shape[1]
bs = input_shape[0]
half_n = self.localSize // 2
input_sqr = T.sqr(x)
extra_channels = T.alloc(0., bs, ch + 2*half_n, *input_shape[2:])
input_sqr = T.set_subtensor(extra_channels[:, half_n:half_n+ch, :, :]
, input_sqr)
scale = 1
for i in range(self.localSize):
scale += self.alpha/self.localSize * input_sqr[:, i:i+ch, ...]
scale = scale ** self.beta
return (x/scale, )
评论列表
文章目录