File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 2222)
2323from executorch .exir ._serialize ._serialize import serialize_for_executorch
2424from executorch .exir ._serialize .data_serializer import DataSerializer
25+ from executorch .exir ._warnings import experimental
2526from executorch .exir .backend .backend_api import (
2627 MethodProgramsPartitionerSpec ,
2728 to_backend ,
@@ -626,6 +627,24 @@ def buffer(self) -> bytes:
626627 self ._buffer = bytes (self ._get_pte_data ())
627628 return self ._buffer
628629
630+ @property
631+ @experimental ("This API is experimental and subject to change without notice." )
632+ def data_files (self ) -> Dict [str , bytes ]:
633+ """Returns the data files as a dictionary of filename to byte data.
634+
635+ Returns:
636+ Dict[str, bytes]: Dictionary mapping data filenames (e.g., .ptd files) to
637+ their serialized byte content.
638+ Returns empty dict if no data files are available.
639+ """
640+ if self ._pte_data is None :
641+ self ._get_pte_data () # This populates _tensor_data
642+
643+ if self ._tensor_data is None :
644+ return {}
645+
646+ return {filename : bytes (cord ) for filename , cord in self ._tensor_data .items ()}
647+
629648 @property
630649 def program (self ) -> Program :
631650 return self ._get_emitter_output ().program
You can’t perform that action at this time.
0 commit comments