MCPcopy Create free account
hub / github.com/pytorch/executorch / _do_user_inputs_exist

Function _do_user_inputs_exist

exir/memory_planning.py:511–531  ·  view source on GitHub ↗
(graph_signature: Optional[ExportGraphSignature])

Source from the content-addressed store, hash-verified

509
510
511def _do_user_inputs_exist(graph_signature: Optional[ExportGraphSignature]) -> bool:
512 if graph_signature is None:
513 return False
514
515 user_inputs = list(
516 filter(
517 lambda input: input.kind == InputKind.USER_INPUT,
518 graph_signature.input_specs,
519 )
520 )
521
522 # Return false if:
523 # - there are no inputs.
524 # - if user inputs are all prims (as this currently
525 # causes the memory planning verifier to blow up).
526 # Otherwise, return true.
527 return any(
528 not isinstance(input.arg, ConstantArgument)
529 or not isinstance(input.arg.value, (int, float, bool, str))
530 for input in user_inputs
531 )
532
533
534def get_graph_input_tensors(

Callers 5

test_mixed_inputsMethod · 0.90
test_no_inputsMethod · 0.90

Calls

no outgoing calls

Tested by 4

test_mixed_inputsMethod · 0.72
test_no_inputsMethod · 0.72