我想改变张量流量张量的形状。 set_shape
在这种情况下不起作用,因为我试图重新定义以前定义的维度:
ValueError: Shapes (?, 144, 192, 1) and (?, 212, 156, 1) are not compatible
这似乎有效,但需要访问受保护的字段:
t._shape = tf.TensorShape([tf.Dimension(x) for x in new_shape])
有更好的方法吗?我知道我在这里做什么,会喜欢强行改变张量的形状。