convolution_1d.py 文件源码

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

项目:chainer-qrnn 作者: musyoku 项目源码 文件源码
def _initialize_params(self, t):
        xp = cuda.get_array_module(t)

        self.mean_t = xp.mean(t, axis=(0, 2))           # calculate average for each channel
        self.std_t = xp.sqrt(xp.var(t, axis=(0, 2)))    # calculate stddev for each channel
        g = 1 / self.std_t
        b = -self.mean_t / self.std_t

        # print("g <- {}, b <- {}".format(g.reshape((-1,)), b.reshape((-1,))))

        with self.init_scope():
            if self.nobias == False:
                self.b = Parameter(b, b.shape)

            g_shape = (self.out_channels, 1) + (1,) * len(self.ksize)
            self.g = Parameter(g.reshape(g_shape), g_shape)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号