首页 > 解决方案 > 训练中的“索引处未定义的输入形状”警告

问题描述

Tensorflow2 用于训练,我在对象分类训练中打印出相当多的警告。这些警告的原因可能是什么?

2020-04-17 12:15:16.091784: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 486 in the outer inference context.
2020-04-17 12:15:16.091846: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 414 in the outer inference context.
2020-04-17 12:15:16.091860: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 529 in the outer inference context.
2020-04-17 12:15:16.091882: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 351 in the outer inference context.
2020-04-17 12:15:16.091926: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 476 in the outer inference context.
2020-04-17 12:15:16.091937: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 444 in the outer inference context.
2020-04-17 12:15:16.091953: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 372 in the outer inference context.
2020-04-17 12:15:16.091994: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 466 in the outer inference context.
2020-04-17 12:15:16.092009: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 404 in the outer inference context.
2020-04-17 12:15:16.092015: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 395 in the outer inference context.
2020-04-17 12:15:16.092022: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 341 in the outer inference context.
2020-04-17 12:15:16.092036: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 289 in the outer inference context.
2020-04-17 12:15:16.092060: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 319 in the outer inference context.
2020-04-17 12:15:16.092076: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 249 in the outer inference context.
2020-04-17 12:15:16.092087: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 219 in the outer inference context.
2020-04-17 12:15:16.092107: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 279 in the outer inference context.
2020-04-17 12:15:16.092119: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 240 in the outer inference context.
2020-04-17 12:15:16.092136: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 309 in the outer inference context.
2020-04-17 12:15:16.092160: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 210 in the outer inference context.
2020-04-17 12:15:16.092177: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 270 in the outer inference context.
2020-04-17 12:15:16.092193: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 330 in the outer inference context.
2020-04-17 12:15:16.092203: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 300 in the outer inference context.
2020-04-17 12:15:16.092238: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 229 in the outer inference context.
2020-04-17 12:15:16.092248: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 199 in the outer inference context.
2020-04-17 12:15:16.092262: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 259 in the outer inference context.
2020-04-17 12:15:16.092281: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 176 in the outer inference context.
2020-04-17 12:15:16.092291: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 156 in the outer inference context.
2020-04-17 12:15:16.092301: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 124 in the outer inference context.
2020-04-17 12:15:16.092325: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 115 in the outer inference context.
2020-04-17 12:15:16.092339: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 384 in the outer inference context.
2020-04-17 12:15:16.092353: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 361 in the outer inference context.
2020-04-17 12:15:16.092387: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 166 in the outer inference context.
2020-04-17 12:15:16.092396: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 145 in the outer inference context.
2020-04-17 12:15:16.092444: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 104 in the outer inference context.
2020-04-17 12:15:16.092454: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 134 in the outer inference context.
2020-04-17 12:15:16.092464: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 187 in the outer inference context.
2020-04-17 12:15:16.092516: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 550 in the outer inference context.
2020-04-17 12:15:16.092529: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 581 in the outer inference context.
2020-04-17 12:15:16.092548: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 520 in the outer inference context.
2020-04-17 12:15:16.092576: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 425 in the outer inference context.
2020-04-17 12:15:16.092604: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 497 in the outer inference context.
2020-04-17 12:15:16.092627: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 571 in the outer inference context.
2020-04-17 12:15:16.092639: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 539 in the outer inference context.
2020-04-17 12:15:16.092666: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 434 in the outer inference context.
2020-04-17 12:15:16.092674: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 94 in the outer inference context.
2020-04-17 12:15:16.092712: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 85 in the outer inference context.
2020-04-17 12:15:16.092840: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 455 in the outer inference context.
2020-04-17 12:15:16.092862: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 561 in the outer inference context.
2020-04-17 12:15:16.092881: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 509 in the outer inference context.
2020-04-17 12:15:16.313307: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 156 in the outer inference context.
2020-04-17 12:15:16.313353: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 134 in the outer inference context.
2020-04-17 12:15:16.313373: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 571 in the outer inference context.
2020-04-17 12:15:16.313391: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 561 in the outer inference context.
2020-04-17 12:15:16.313415: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 539 in the outer inference context.
2020-04-17 12:15:16.313448: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 414 in the outer inference context.
2020-04-17 12:15:16.313463: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 529 in the outer inference context.
2020-04-17 12:15:16.313471: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 509 in the outer inference context.
2020-04-17 12:15:16.313489: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 550 in the outer inference context.
2020-04-17 12:15:16.313495: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 94 in the outer inference context.
2020-04-17 12:15:16.313521: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 581 in the outer inference context.
2020-04-17 12:15:16.313546: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 85 in the outer inference context.
2020-04-17 12:15:16.313643: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 444 in the outer inference context.
2020-04-17 12:15:16.313655: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 404 in the outer inference context.
2020-04-17 12:15:16.313672: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 520 in the outer inference context.
2020-04-17 12:15:16.313684: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 476 in the outer inference context.
2020-04-17 12:15:16.313721: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 434 in the outer inference context.
2020-04-17 12:15:16.313732: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 395 in the outer inference context.
2020-04-17 12:15:16.313741: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 372 in the outer inference context.
2020-04-17 12:15:16.313754: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 497 in the outer inference context.
2020-04-17 12:15:16.313764: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 466 in the outer inference context.
2020-04-17 12:15:16.313799: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 341 in the outer inference context.
2020-04-17 12:15:16.313827: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 425 in the outer inference context.
2020-04-17 12:15:16.313850: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 361 in the outer inference context.
2020-04-17 12:15:16.313861: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 486 in the outer inference context.
2020-04-17 12:15:16.313873: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 455 in the outer inference context.
2020-04-17 12:15:16.313925: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 124 in the outer inference context.
2020-04-17 12:15:16.313957: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 145 in the outer inference context.
2020-04-17 12:15:16.313976: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 229 in the outer inference context.
2020-04-17 12:15:16.313985: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 351 in the outer inference context.
2020-04-17 12:15:16.313994: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 330 in the outer inference context.
2020-04-17 12:15:16.314011: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 270 in the outer inference context.
2020-04-17 12:15:16.314017: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 384 in the outer inference context.
2020-04-17 12:15:16.314030: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 219 in the outer inference context.
2020-04-17 12:15:16.314061: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 309 in the outer inference context.
2020-04-17 12:15:16.314068: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 300 in the outer inference context.
2020-04-17 12:15:16.314085: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 104 in the outer inference context.
2020-04-17 12:15:16.314139: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 210 in the outer inference context.
2020-04-17 12:15:16.314172: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 289 in the outer inference context.
2020-04-17 12:15:16.314183: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 259 in the outer inference context.
2020-04-17 12:15:16.314213: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 319 in the outer inference context.
2020-04-17 12:15:16.314234: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 249 in the outer inference context.
2020-04-17 12:15:16.314248: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 115 in the outer inference context.
2020-04-17 12:15:16.314272: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 199 in the outer inference context.
2020-04-17 12:15:16.314282: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 176 in the outer inference context.
2020-04-17 12:15:16.314289: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 240 in the outer inference context.
2020-04-17 12:15:16.314313: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 279 in the outer inference context.
2020-04-17 12:15:16.314325: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 187 in the outer inference context.
2020-04-17 12:15:16.314357: W tensorflow/core/common_runtime/shape_refiner.cc:88] Function instantiation has undefined input shape at index: 166 in the outer inference context.

标签: tensorflow2.0

解决方案


我有类似的错误弹出。我使用了来自生成器的数据集,但没有指定生成器的输出形状。添加输出形状后,没有生成警告:

tf.data.Dataset.from_generator(generator, output_types=(tf.float32, tf.float32), output_shapes=(tf.TensorShape([2997, 16]), tf.TensorShape([None])))

推荐阅读