tf.tile()函数的用法

 

y = tf.tile(tf.range(2, dtype=tf.int32)[:, tf.newaxis], [2,3])  # tf.tile(input,[a,b]) 输入数据,按照对应维度将矩阵重复a次和b次

y1=tf.range(2, dtype=tf.int32)
y2=tf.range(2, dtype=tf.int32)[:, tf.newaxis] # 将一维度矩阵增加一维度,列为1
sess=tf.Session()
a=sess.run(y)
print(a)
b=sess.run(y1)
print('y1=',b)
c=sess.run(y2)
print('y2=',c)

 

 

posted @ 2019-08-29 17:44  tangjunjun  阅读(1403)  评论(0编辑  收藏  举报
https://rpc.cnblogs.com/metaweblog/tangjunjun