You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds file-backed serialization support to ExecuTorch, allowing
large named-data blobs to be hashed, deduplicated, and written in chunks
without loading them entirely into memory. It also introduces backend
hooks for controlling program copying and AOTI weight materialization
while preserving existing behavior by default.
data (Union[bytes, torch.Tensor]): Union of bytes, or torch.Tensor to serialize. Note: if a tensor is passed, it must have contiguous memory layout. The tensor_layout will be inferred from the tensor and should not be passed in.
189
+
data: Bytes, file-backed data, or a torch.Tensor to serialize. If a
190
+
tensor is passed, its layout is inferred.
175
191
alignment (int): alignment for bytes to be serialized with.
176
192
external (Optional[str]): the external filename that this data is saved to.
177
193
tensor_layout (Optional[TensorLayout]): layout of the tensor, if applicable.
@@ -194,8 +210,10 @@ def add_named_data(
194
210
)
195
211
tensor_layout=real_tensor_layout
196
212
byte_data=_tensor_to_bytes(data)
197
-
else:
213
+
elifisinstance(data, (bytes, FileBackedData)):
198
214
byte_data=data
215
+
else:
216
+
raiseTypeError(f"Unsupported named data type: {type(data)}")
0 commit comments