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

Function _get_program_output_spec

backends/nxp/tests/nsys_testing.py:640–666  ·  view source on GitHub ↗

Get output tensor specification for provided program. :param exported_program: Exported program. :return: List of output PyTorch tensors.

(exported_program)

Source from the content-addressed store, hash-verified

638
639
640def _get_program_output_spec(exported_program) -> list[torch.Tensor]:
641 """
642 Get output tensor specification for provided program.
643
644 :param exported_program: Exported program.
645 :return: List of output PyTorch tensors.
646 """
647
648 # TODO robert: since version 0.5 the user_outputs are not updated after delegation.
649 # Hence bellow code does not works
650 # Remove/update if the feature/bug if confirmed.
651 #
652 # nodes = list(exported_program.graph.nodes)
653 #
654 # program_outputs = exported_program.graph_signature.user_outputs
655 #
656 # output_tensors_spec = []
657 #
658 # for node in nodes:
659 # if node.name in program_outputs:
660 # output_tensors_spec.append(node.meta["val"])
661 #
662 # assert len(output_tensors_spec) == len(program_outputs)
663
664 output_tensors_spec = list(exported_program.graph.output_node().meta["val"])
665
666 return output_tensors_spec

Callers 2

lower_run_compareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected