tf.tile详解(能懂版)

版权声明:如使用此博客内容,请经过作者同意,谢谢 https://blog.csdn.net/qq_40994943/article/details/85401712
 import tensorflow as tf
    temp = tf.tile([1,2,3],[2])
    temp2 = tf.tile([[1,2],[3,4],[5,6]],[2,3])
    with tf.Session() as sess:
        print(sess.run(temp))
        print(sess.run(temp2))

output:
在这里插入图片描述

import tensorflow as tf
temp = tf.tile([[1,2,3],[1,2,3]],[1,1])
temp2 = tf.tile([[1,2,3],[1,2,3]],[2,1])
temp3 = tf.tile([[1,2,3],[1,2,3]],[2,2])
with tf.Session() as sess:
    print(sess.run(temp))
    print(sess.run(temp2))
    print(sess.run(temp3))

output:

#(1,1)代表不变
    [[1 2 3] 
    [1 2 3]]
#(2,1)代表行方向复制成两个原矩阵,列方向不变
    [[1 2 3] 
    [1 2 3] 
    [1 2 3] 
    [1 2 3]]
#(2,2)代表行列方向都复制成两份
    [[1 2 3 1 2 3] 
    [1 2 3 1 2 3] 
    [1 2 3 1 2 3] 
    [1 2 3 1 2 3]]

refer to blog

猜你喜欢

转载自blog.csdn.net/qq_40994943/article/details/85401712