test_linalg.py 文件源码

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

项目:npstreams 作者: LaurentRDC 项目源码 文件源码
def test_against_numpy_einsum(self):
        """ Test against numpy.einsum  """
        a = np.arange(60.).reshape(3,4,5)
        b = np.arange(24.).reshape(4,3,2)
        stream = [a, b]

        from_numpy = np.einsum('ijk,jil->kl', a, b)
        from_stream = last(ieinsum(stream, 'ijk,jil->kl'))

        self.assertSequenceEqual(from_numpy.shape, from_stream.shape)
        self.assertTrue(np.allclose(from_numpy, from_stream))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号