{"record":{"id":"1374a957e4656db2","repo":"keras-team/keras","slug":"failed-to-convert-pytorch-model-to-litert-common","errorCode":null,"errorMessage":"Failed to convert PyTorch model to LiteRT. Common causes: unsupported operations, dynamic shapes, or complex control flow. Original error: {e}","messagePattern":"Failed to convert PyTorch model to LiteRT\\. Common causes: unsupported operations, dynamic shapes, or complex control flow\\. Original error: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"keras/src/export/litert.py","lineNumber":246,"sourceCode":"\n                # Although Keras models manage training mode via the\n                # `training` argument to `call()`, `litert_torch.convert`\n                # checks `module.training` and warns when it is `True`.\n                # Calling `eval()` silences that warning and ensures any\n                # PyTorch-native submodules are in inference mode.\n                model.eval()\n\n                litert_torch_kwargs = _prepare_litert_kwargs(\n                    kwargs, litert_torch\n                )\n\n                with _silence_output(verbose is False):\n                    try:\n                        edge_model = litert_torch.convert(\n                            model, sample_inputs, **litert_torch_kwargs\n                        )\n                    except Exception as e:\n                        raise RuntimeError(\n                            \"Failed to convert PyTorch model to LiteRT. \"\n                            \"Common causes: unsupported operations, \"\n                            \"dynamic shapes, or complex control flow. \"\n                            f\"Original error: {e}\"\n                        ) from e\n\n                    edge_model.export(filepath)\n        finally:\n            if device != \"cpu\":\n                for v in model.variables:\n                    v.value.data = v.value.data.to(device)\n\n    if verbose is not False:\n        io_utils.print_msg(f\"Saved artifact at '{filepath}'.\")\n\n    return filepath\n\n","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/export/litert.py#L228-L264","documentation":"Error \"Failed to convert PyTorch model to LiteRT. Common causes: unsupported operations, dynamic shapes, or complex control flow. Original error: {e}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/export/litert.py:246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}