由于需要匹配形状而导致层级错误,但是它们都已经匹配

时间:2019-12-18 14:57:58

标签: python python-3.x tensorflow tensorflow2.0

这是错误。您看到任何不匹配的形状吗?

A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [[(None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1)], [(None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1), (None, 1, 1)]]

TF是不是真的想说些什么?

1 个答案:

答案 0 :(得分:0)

的确,TF试图说形状还不错,但是有两个列表,它只需要一个列表。 (文档和错误消息可能会更好。)我通过实验弄清楚了。形状不是问题。

修复它的代码:

  all_outputs_in_1_list = []
  all_outputs_in_1_list.extend(bias_outputs)
  all_outputs_in_1_list.extend(mm_outputs)
  x = concatenate(all_outputs_in_1_list)