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.
分类:
Tensorflow
标签:
tensorflow
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix