tf.broadcast_to()

2022-09-03 20:00:46 浏览数 (1)

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]]
-----------------

0 人点赞