tf.tile()用法
阿新 • • 發佈:2018-11-08
版權宣告:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/Eric_LH/article/details/79074583
tile() 平鋪之意,用於在同一維度上的複製
tf.tile( input, #輸入 multiples, #同一維度上覆制的次數 name=None ) # a = tf.constant([1,2],name='a') # b= tf.tile(a,[1,2]) # sess = tf.Session() # print(sess.run(b)) # [[1,2] [1,2]]
error:ValueError: Shape must be rank 1 but is rank 2 for ‘Tile’ (op: ‘Tile’) with input shapes: [2], [2].
import tensorflow as tf
a = tf.constant([[1,2]],name='a')
b= tf.tile(a,[1,2])
sess = tf.Session()
print(sess.run(b))
output:
[[1 2 1 2]]
import tensorflow as tf a = tf.constant([[1,2]],name='a') b= tf.tile(a,[2,1]) sess = tf.Session() print(sess.run(b))
output:
[[1 2]
[1 2]]
參考部落格:
http://blog.csdn.net/xwd18280820053/article/details/72867818
--------------------- 本文來自 Eric_LH 的CSDN 部落格 ,全文地址請點選:https://blog.csdn.net/eric_lh/article/details/79074583?utm_source=copy