Skip to content

Commit 693bbbc

Browse files
committed
Last changes
1 parent e297c9b commit 693bbbc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

exir/emit/_emitter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,8 @@ def _find_fqn_for_placeholder(
15751575
warnings.warn(
15761576
"Mutation on a buffer in the model is detected. ExecuTorch assumes "
15771577
"buffers that are mutated in the graph have a meaningless initial state, "
1578-
"only the shape and dtype will be serialized.",
1578+
"only the shape and dtype will be serialized, unless a pass which marks "
1579+
"spec.const=True such as InitializedMutableBufferPass is run.",
15791580
UserWarning,
15801581
stacklevel=1,
15811582
)

exir/passes/init_mutable_pass.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ def __init__(self, patterns: List[str]) -> None:
2424
self.patterns = patterns
2525

2626
def placeholder(self, name: str, arg, meta):
27+
pattern_found = False
2728
for pattern in self.patterns:
2829
if pattern in name:
2930
meta["et_init_buffer"] = True
31+
pattern_found = True
32+
if not pattern_found:
33+
raise ValueError(
34+
f"Could not match any of {self.patterns} to the model's placeholders."
35+
)
3036

3137
return super().placeholder(name, arg, meta)

0 commit comments

Comments
 (0)