test_tdnn.py 文件源码

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

项目:tf-lstm-char-cnn 作者: mkroutikov 项目源码 文件源码
def test(self):

        with self.test_session() as sess:

            inp = tf.constant(np.array([
                [[1.0], [2.0], [2.0], [0.0]]
            ], dtype=np.float32))

            x = tdnn(inp, [2], [1])

            result = sess.run(x, {
                'TDNN/kernel_2/w:0': np.array([[[[1.0]], [[-1.0]]]]),
                'TDNN/kernel_2/b:0': np.array([1.0]),
            })

            print(result)
            self.assertAllClose(result, [[np.tanh(3.0)]])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号