test_reduce.py 文件源码

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

项目:npstreams 作者: LaurentRDC 项目源码 文件源码
def test_out_parameter(self):
        """ Test that the kwargs ``out`` is correctly passed to reduction function """

        with self.subTest('axis = -1'):
            not_out = last(ireduce_ufunc(self.source, np.add, axis = -1))
            out = np.empty_like(self.source[0])
            last(ireduce_ufunc(self.source, ufunc = np.add, out = out))

            self.assertTrue(np.allclose(not_out, out))

        with self.subTest('axis != -1'):
            not_out = last(ireduce_ufunc(self.source, np.add, axis = 2))
            out = np.empty_like(self.source[0])
            from_out = last(ireduce_ufunc(self.source, ufunc = np.add, out = out, axis = 2))

            self.assertTrue(np.allclose(not_out, from_out))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号