Export a model and generate a .pte file.
(model, example_inputs, output_path)
| 62 | |
| 63 | |
| 64 | def export_and_generate_pte(model, example_inputs, output_path): |
| 65 | """Export a model and generate a .pte file.""" |
| 66 | exported_program = torch.export.export(model, example_inputs) |
| 67 | edge_program_manager = to_edge_transform_and_lower( |
| 68 | exported_program, |
| 69 | partitioner=None, |
| 70 | compile_config=EdgeCompileConfig( |
| 71 | _core_aten_ops_exception_list=[ |
| 72 | torch.ops.aten.bitwise_left_shift.Tensor, |
| 73 | torch.ops.aten.bitwise_left_shift.Tensor_Scalar, |
| 74 | torch.ops.aten.bitwise_right_shift.Tensor, |
| 75 | torch.ops.aten.bitwise_right_shift.Tensor_Scalar, |
| 76 | ] |
| 77 | ), |
| 78 | ) |
| 79 | executorch_program_manager = edge_program_manager.to_executorch( |
| 80 | config=ExecutorchBackendConfig(extract_delegate_segments=False) |
| 81 | ) |
| 82 | save_pte_program(executorch_program_manager, str(output_path)) |
| 83 | |
| 84 | |
| 85 | class TestBitwiseShiftOperators(unittest.TestCase): |
no test coverage detected