graph_convolution.py 文件源码

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

项目:chainer-graph-cnn 作者: pfnet-research 项目源码 文件源码
def forward_cpu(self, inputs):
        x, W = inputs[:2]
        n_batch, c_in, N = x.shape
        b = inputs[2] if len(inputs) == 3 else None

        K = self.K
        if x.dtype != self.LmI.dtype:
            self.LmI = self.LmI.astype(x.dtype)

        C = np.empty((n_batch, K, N, c_in), dtype=x.dtype)
        chebyshev_matvec_cpu(C, x, K, n_batch, self.LmI)
        C = C.transpose((0, 3, 1, 2))
        self.C = C
        y = np.tensordot(C, W, ((1, 2), (1, 2)))

        if b is not None:
            y += b

        return np.rollaxis(y, 2, 1),  # y.shape = (n_batch, c_out, N)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号