Convert the graph into a Program. WARN: When the graph includes backward operator nodes, the conversion process may be failed. Usually, this function is only used to convert a test graph. Returns: Program: a program converted from the graph.
(self)
| 5966 | _convert_to_pdf(viz_dot_path) |
| 5967 | |
| 5968 | def to_program(self): |
| 5969 | """ |
| 5970 | Convert the graph into a Program. |
| 5971 | |
| 5972 | WARN: When the graph includes backward operator nodes, the |
| 5973 | conversion process may be failed. Usually, this function is |
| 5974 | only used to convert a test graph. |
| 5975 | |
| 5976 | Returns: |
| 5977 | Program: a program converted from the graph. |
| 5978 | """ |
| 5979 | convert_pass = core.get_pass("graph_to_program_pass") |
| 5980 | desc = core.ProgramDesc() |
| 5981 | convert_pass.set_not_owned("program", desc) |
| 5982 | convert_pass.apply(self.graph) |
| 5983 | program = Program._construct_from_desc(desc) |
| 5984 | return program |
| 5985 | |
| 5986 | def _find_node_by_name(self, nodes, node_name): |
| 5987 | """ |