Skip to content

Commit 5a072a8

Browse files
committed
fix?
1 parent 8fbdb17 commit 5a072a8

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

exir/memory_planning.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,9 @@ def verify_graph_input_output(self) -> None:
248248
has_dynamic_unbound_output |= has_dynamic_unbound_tensor
249249

250250
# only check if inputs are allocated if there are user inputs:
251-
user_inputs_exist = (
252-
len(
253-
list(
254-
filter(
255-
lambda input: input.kind == InputKind.USER_INPUT,
256-
self.graph_signature.input_specs,
257-
)
258-
)
259-
)
260-
) > 0
251+
user_inputs_exist = _does_user_inputs_exist(
252+
graph_signature=self.graph_signature
253+
)
261254

262255
if "placeholder" in check_list and user_inputs_exist:
263256
assert graph_input_allocated is not None, "graph_input_allocated not set"
@@ -339,6 +332,22 @@ def _is_mutable_buffer(
339332
return False
340333

341334

335+
def _does_user_inputs_exist(graph_signature: Optional[ExportGraphSignature]) -> bool:
336+
if graph_signature is None:
337+
return False
338+
339+
return (
340+
len(
341+
list(
342+
filter(
343+
lambda input: input.kind == InputKind.USER_INPUT,
344+
graph_signature.input_specs,
345+
)
346+
)
347+
)
348+
) > 0
349+
350+
342351
def get_graph_input_tensors(
343352
nodes: Iterable[Node], graph_signature: Optional[ExportGraphSignature] = None
344353
) -> Set[TensorSpec]:

0 commit comments

Comments
 (0)