Returns a transformed ExportedProgram
(self)
| 94 | return self._exported_program |
| 95 | |
| 96 | def transform(self) -> ExportedProgram: |
| 97 | """ |
| 98 | Returns a transformed ExportedProgram |
| 99 | """ |
| 100 | ep = self.exported_program |
| 101 | for pass_ in self.passes: |
| 102 | if issubclass(pass_, XNNPACKPass): |
| 103 | transform_pass = pass_(ep) |
| 104 | elif issubclass(pass_, ExportPass): |
| 105 | transform_pass = pass_() |
| 106 | else: |
| 107 | raise RuntimeError( |
| 108 | f"Expecting ExportPass or ExportPass(), but got pass: {pass_} with type: {type(pass_)}" |
| 109 | ) |
| 110 | ep = _transform(ep, transform_pass) |
| 111 | return ep |