【发布时间】:2020-07-01 09:01:17
【问题描述】:
我对这个操作的输出形状有点困惑
>>> eps = tf.random.uniform((3))
>>> images = tf.random.normal((3, 28, 28, 1))
>>> output = eps * images
>>> output.get_shape()
(3, 28, 28, 3)
我希望这将 eps 中的每个标量与图像中形状 (28, 28, 1) 的每个图像相乘,以获得输出形状 (3, 28, 28, 1)
类似的东西
>>> output = []
>>> output.append(eps[0] * images[0])
>>> output.append(eps[1] * images[1])
>>> output.append(eps[2] * images[2])
>>> output = tf.convert_to_tensor(output)
>>> output.get_shape()
(3, 28, 28, 1)
请帮忙。
【问题讨论】:
标签: python tensorflow broadcasting