test_core.py 文件源码

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

项目:deep-coref 作者: clarkkev 项目源码 文件源码
def test_non_zero_output(self):
        """Test output of masking layer with non-zero mask value"""
        layer = core.Masking(5)
        func = theano.function([layer.input], layer.get_output())
        self.assertTrue(np.all(
            # get output for this input, replace padding with 0
            func(np.array([[[1, 1], [2, 1], [3, 1], [5, 5]],
                          [[1, 5], [5, 0], [0, 0], [0, 0]]], dtype=np.int32)) ==
            # This is the expected output
            np.array([[[1, 1], [2, 1], [3, 1], [0, 0]],
                     [[1, 5], [5, 0], [0, 0], [0, 0]]])))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号