File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
extension/flat_tensor/serialize Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ runtime.python_library(
2929 ],
3030 visibility = [
3131 "//executorch/...",
32+ "@EXECUTORCH_CLIENTS",
3233 ],
3334 deps = [
3435 ":schema",
Original file line number Diff line number Diff line change 2020from executorch .exir ._serialize ._cord import Cord
2121from executorch .exir ._serialize ._dataclass import _DataclassEncoder , _json_to_dataclass
2222from executorch .exir ._serialize ._flatbuffer import _flatc_compile , _flatc_decompile
23+ from executorch .exir ._serialize ._named_data_store import NamedDataStoreOutput
2324from executorch .exir ._serialize ._program import _insert_flatbuffer_header
2425from executorch .exir ._serialize .data_serializer import (
2526 DataEntry ,
@@ -389,6 +390,8 @@ def serialize(
389390 def deserialize (self , blob : Cord ) -> DataPayload :
390391 """
391392 Deserializes a flat_tensor blob into a list of tensor metadata and tensors.
393+
394+ Note: deserialization does not preserve alignment information.
392395 """
393396
394397 data = bytes (blob )
@@ -436,3 +439,14 @@ def deserialize(self, blob: Cord) -> DataPayload:
436439 payload .named_data [named_data .key ] = entry
437440
438441 return payload
442+
443+ def deserialize_to_named_data_store_output (
444+ self , blob : bytes , name : str
445+ ) -> NamedDataStoreOutput :
446+ bytes = Cord (blob )
447+ data_payload = self .deserialize (bytes )
448+ return NamedDataStoreOutput (
449+ buffers = data_payload .buffers ,
450+ pte_data = {},
451+ external_data = {name : data_payload .named_data },
452+ )
You can’t perform that action at this time.
0 commit comments