ValueError: The two structures don't have the same sequence length. Input structure has length 4, while shallow structure has length 3.
ValueError: The two structures don't have the same sequence length. Input structure has length 4, while shallow structure has length 3.
整体报错:
/opt/conda/lib/python3.6/site-packages/tensorflow/python/util/nest.py:1460 map_structure_with_tuple_paths_up_to
expand_composites=expand_composites)
/opt/conda/lib/python3.6/site-packages/tensorflow/python/util/nest.py:1091 assert_shallow_structure
input_length=len(input_tree), shallow_length=len(shallow_tree)))
ValueError: The two structures don't have the same sequence length. Input structure has length 4, while shallow structure has length 3.
参考资料
解决
问题主要是两组结构的序列长度不同,这里需要检查一下所使用的特征以及模型结构的输入输出维度是否发生变化。
在我这个代码当中,主要是模型的输出头的个数发生了变化,在dataset当中配置了4个label输出,实际模型错误地写成了3个输出头。
比如
task_output = [task_ouput_1, task_output_2, task_output_3]
train_model = tf.keras.models.Model(inputs=get_keras_model_input(inputs, task_outputs)
修改成
task_output = [task_ouput_1, task_output_2, task_output_3, task_output_4]
train_model = tf.keras.models.Model(inputs=get_keras_model_input(inputs, task_outputs)
___________________
文章转载请注明出处,喜欢文章的话请我喝一杯咖啡吧!在右边赞助里面哦!谢谢! NoMornings.
文章转载请注明出处,喜欢文章的话请我喝一杯咖啡吧!在右边赞助里面哦!谢谢! NoMornings.