basic_test.py 文件源码

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

项目:sonnet 作者: deepmind 项目源码 文件源码
def testComparison(self):
    # Here we compare the output with the `tf.tile` equivalent.
    in_shape = [2, 3, 4]
    inputs = tf.random_uniform(shape=in_shape)

    dims = [0, 2]
    multiples = [2, 4]
    mod = snt.TileByDim(dims=dims, multiples=multiples)
    output = mod(inputs)

    multiple_tf = [2, 1, 4]
    ref_output = tf.tile(inputs, multiples=multiple_tf)

    with self.test_session() as sess:
      actual, expected = sess.run([output, ref_output])
      self.assertAllEqual(actual, expected)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号