Get output tensor specification for provided program. :param exported_program: Exported program. :return: List of output PyTorch tensors.
(exported_program)
| 638 | |
| 639 | |
| 640 | def _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 |
no outgoing calls
no test coverage detected