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