运行tf.reshape函数时出现类型错误

时间:2020-04-08 23:59:05

标签: python tensorflow tensorflow2.0

运行tf.reshape函数时出现以下错误。

TypeError:无法将类型的对象转换为Tensor。内容:[Dimension(1),Dimension(3),Dimension(16)]。考虑将元素强制转换为受支持的类型。

我正在测试以下代码段。

with tf.Session() as test:
   tf.set_random_seed(1)
   a_C = tf.random_normal([1, 4, 4, 3], mean=1, stddev=4)
   m,n_H,n_W,n_C = a_C.shape
   a_Cu = tf.reshape(a_C, shape=[m,n_C,-1])
   test.run(a_Cu)

该错误似乎与我用于形状的列表有关,但是文档中也使用了列表。 请问我在做什么错?

0 个答案:

没有答案