tf.tile()其實就是貼瓷磚

tf.tile(
    input,
    multiples,
    name=None
)

Args:

  • input: A Tensor. 1-D or higher.
  • multiples: A Tensor. Must be one of the following types: int32int64. 1-D. Length must be the same as the number of dimensions in input
  • name: A name for the operation (optional).
import tensorflow as tf

a = tf.constant([[1, 2], [3, 4], [5, 6]], dtype=tf.int32)
a1 = tf.tile(a, [3, 2])
print(a.get_shape())
print(a1.get_shape())

with tf.Session() as sess:
    print(sess.run(a))
    print(sess.run(a1))

(3, 2)
(9, 4)

先axis0方向貼3塊,然後axis1方向貼2塊。

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章