1
我在编码期间遇到此问题。我有一个占位符tensorflow:修改占位符的形状
x = tf.placeholder(tf.float32,[None,128])
我想生成一些噪声与维度10并与x连接。噪声的数量应该匹配xs的数量,在这里显示为None,并在稍后提供。在numpy的,我会做它:
noise_shape=[x.shape[0],10]
noise = tf.random_normal(shape=noise_shape)
out = tf.concat(axis=1, values=[x, noise])
但在tensorflow,[x.shape [0],10]不起作用。任何人都可以点亮我怎么做到这一点?
非常感谢!你的解决方案绝对有效我以这种方式改变了我的代码。后来我发现如果我将x.shape [0]更改为tf.shape(x)[0],它也可以工作。 –
@明章迈克尔因为解决方案有效,请*接受*(答案占用受访者宝贵的时间) – desertnaut