Add exported program to the ETRecord after it has been created. This method allows users to add an exported program they want to record to an existing ETRecord instance. The exported program will be included when the ETRecord is saved. Args: exp
(
self,
exported_program: Optional[Union[ExportedProgram, Dict[str, ExportedProgram]]],
)
| 399 | self._representative_inputs = representative_inputs |
| 400 | |
| 401 | def add_exported_program( |
| 402 | self, |
| 403 | exported_program: Optional[Union[ExportedProgram, Dict[str, ExportedProgram]]], |
| 404 | ) -> None: |
| 405 | """ |
| 406 | Add exported program to the ETRecord after it has been created. |
| 407 | |
| 408 | This method allows users to add an exported program they want to record |
| 409 | to an existing ETRecord instance. The exported program will be included |
| 410 | when the ETRecord is saved. |
| 411 | |
| 412 | Args: |
| 413 | exported_program: The exported program for this model returned by the call to |
| 414 | `torch.export()` or a dictionary with method names as keys and exported programs as values. |
| 415 | Can be None, in which case no exported program data will be added. |
| 416 | |
| 417 | Raises: |
| 418 | RuntimeError: If exported program already exists in the ETRecord. |
| 419 | """ |
| 420 | # Check if exported program already exists |
| 421 | if self.exported_program is not None or self.export_graph_id is not None: |
| 422 | raise RuntimeError( |
| 423 | "Exported program already exists in the ETRecord. " |
| 424 | "Cannot add exported program when it already exists." |
| 425 | ) |
| 426 | |
| 427 | # Process exported program and extract data |
| 428 | processed_exported_program, export_graph_id = _process_exported_program( |
| 429 | exported_program |
| 430 | ) |
| 431 | |
| 432 | # Set the extracted data |
| 433 | self.exported_program = processed_exported_program |
| 434 | self.export_graph_id = export_graph_id |
| 435 | |
| 436 | def add_edge_dialect_program( |
| 437 | self, |