Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions exir/passes/convert_constant_dim_order_pass.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import logging

import torch
from torch.export import ExportedProgram
from torch.export.graph_signature import InputKind

logger = logging.getLogger(__name__)


def _should_transform(tensor: torch.Tensor) -> bool:
"""
Expand All @@ -17,7 +21,7 @@ def _update_placeholder_meta(
exported_program: ExportedProgram,
target: str,
kind: InputKind,
):
) -> None:
input_spec = next(
(
spec
Expand All @@ -27,7 +31,8 @@ def _update_placeholder_meta(
None,
)
if input_spec is None:
raise RuntimeError(f"Missing input spec for lifted tensor {target}.")
logger.warning(f"Missing input spec for constant {target}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know when the export program may not have input_spec? Doesn't every program have that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can track down a better repro. This showed up with an internal CV model. My guess is that there is some pass that is modifying the constant and it hasn't been fully re-lifted at this point. I'll see if I can find an exact case. There are several broken internal tests for export currently.

return

placeholder_node = next(
(
Expand All @@ -37,8 +42,9 @@ def _update_placeholder_meta(
),
None,
)
if input_spec is None:
raise RuntimeError(f"Missing placeholder for {input_spec.arg.name}.")
if placeholder_node is None:
logger.warning(f"Missing placeholder node for constant {target}")
return

placeholder_node.meta["val"] = placeholder_node.meta["val"].contiguous()

Expand Down
Loading