pool.py 文件源码

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

项目:ternarynet 作者: czhu95 项目源码 文件源码
def test_upsample(self):
        h, w = 5, 5
        scale = 2

        mat = np.random.rand(h, w).astype('float32')
        inp = self.make_variable(mat)
        inp = tf.reshape(inp, [1, h, w, 1])

        output = BilinearUpSample('upsample', inp, scale)
        res = self.run_variable(output)[0,:,:,0]

        from skimage.transform import rescale
        res2 = rescale(mat, scale)

        diff = np.abs(res2 - res)

        # not equivalent to rescale on edge?
        diff[0,:] = 0
        diff[:,0] = 0
        if not diff.max() < 1e-4:
            import IPython;
            IPython.embed(config=IPython.terminal.ipapp.load_default_config())
        self.assertTrue(diff.max() < 1e-4)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号