tf.broadcast_to()
tf.broadcast_to() 将原始矩阵成倍增加 参数:
代码语言:javascript复制tf.broadcast_to(
input,
shape,
name=None
)
使用案例:
代码语言:javascript复制import tensorflow as tf
a = [[1, 2, 3], [4, 5, 6]]
b = [4, 6]
sess = tf.Session()
print(sess.run(tf.broadcast_to(a, b)))
Output:
-----------------
[[1 2 3 1 2 3]
[4 5 6 4 5 6]
[1 2 3 1 2 3]
[4 5 6 4 5 6]]
-----------------