{"record":{"id":"51d7ff19204e791e","repo":"PaddlePaddle/PaddleOCR","slug":"invalid-input-name-repr-name-found-in-dynamic-51d7ff","errorCode":null,"errorMessage":"Invalid input name {repr(name)} found in `dynamic_shape_input_data`","messagePattern":"Invalid input name (.+?) found in `dynamic_shape_input_data`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/infer/utility.py","lineNumber":482,"sourceCode":"        config.disable_mkldnn()\n        config.disable_glog_info()\n        return inference.create_predictor(config)\n\n    dynamic_shape_input_data = dynamic_shape_input_data or {}\n\n    predictor = _get_predictor(pp_model_file, pp_params_file)\n    input_names = predictor.get_input_names()\n    for name in dynamic_shapes:\n        if name not in input_names:\n            raise ValueError(\n                f\"Invalid input name {repr(name)} found in `dynamic_shapes`\"\n            )\n    for name in input_names:\n        if name not in dynamic_shapes:\n            raise ValueError(f\"Input name {repr(name)} not found in `dynamic_shapes`\")\n    for name in dynamic_shape_input_data:\n        if name not in input_names:\n            raise ValueError(\n                f\"Invalid input name {repr(name)} found in `dynamic_shape_input_data`\"\n            )\n\n    trt_inputs = []\n    for name, candidate_shapes in dynamic_shapes.items():\n        # XXX: Currently we have no way to get the data type of the tensor\n        # without creating an input handle.\n        handle = predictor.get_input_handle(name)\n        dtype = _pd_dtype_to_np_dtype(handle.type())\n        min_shape, opt_shape, max_shape = candidate_shapes\n        if name in dynamic_shape_input_data:\n            min_arr = np.array(dynamic_shape_input_data[name][0], dtype=dtype).reshape(\n                min_shape\n            )\n            opt_arr = np.array(dynamic_shape_input_data[name][1], dtype=dtype).reshape(\n                opt_shape\n            )\n            max_arr = np.array(dynamic_shape_input_data[name][2], dtype=dtype).reshape(","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/tools/infer/utility.py#L464-L500","documentation":"During TRT engine building, dynamic_shape_input_data optionally provides real calibration/shape data per input. Its keys are validated against predictor.get_input_names(); a key that matches no model input raises this ValueError. It fires after the dynamic_shapes checks, and guards against feeding sample data to a nonexistent tensor, which would silently be ignored or crash the engine build.","triggerScenarios":"Passing dynamic_shape_input_data={'x': [...]} when the model input is named differently ('images', 'input'); reusing the input-data section of an inference.yml with another model.","commonSituations":"Same root cause as the dynamic_shapes mismatches: yml copied between det/rec/e2e models whose tensor names differ, or renamed inputs across export versions.","solutions":["Make the keys of trt_dynamic_shapes_input_data (or the function argument) exactly match predictor.get_input_names()","Remove stale input-data entries entirely if calibration data is not required","Regenerate the config from the model's own inference.yml"],"exampleFix":"# before\ntrt_dynamic_shapes_input_data: {x: [[[...]]]}   # input actually 'images'\n\n# after\ntrt_dynamic_shapes_input_data:\n  images: [[[1,3,48,640]]]","handlingStrategy":"validation","validationCode":"input_names = set(predictor.get_input_names())\nassert set(dynamic_shape_input_data) <= input_names, \\\n    f'dynamic_shape_input_data keys must be actual inputs, got extra: {set(dynamic_shape_input_data) - input_names}'","typeGuard":null,"tryCatchPattern":"try:\n    _convert_trt(dynamic_shapes, model_file, params_file, dynamic_shape_input_data=..., ...)\nexcept ValueError as e:\n    if 'dynamic_shape_input_data' in str(e):\n        dynamic_shape_input_data = {k: v for k, v in dynamic_shape_input_data.items() if k in input_names}\n        _convert_trt(..., dynamic_shape_input_data=dynamic_shape_input_data, ...)\n    raise","preventionTips":["Keep input-data configs in the same file as dynamic_shapes so they are updated together","Prefer omitting calibration data over guessing tensor names"],"tags":["tensorrt","calibration-data","input-names","config-mismatch"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}