normalization.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:sesame-paste-noodle 作者: aissehust 项目源码 文件源码
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, )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号