Skip to content

Implement python deserialize for flat_tensor #11779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GregoryComer
Copy link
Member

Summary

Implement the deserialize function in the Python FlatTensorSerializer class. This allows for loading flatbuffer data from a Python environment.

Test plan

I've added an additional test in extension/flat_tensor/test/test_serialize.py to cover the deserialize path.

Copy link

pytorch-bot bot commented Jun 18, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11779

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 7a33ea8 with merge base 5960a4b (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 18, 2025
@@ -223,3 +225,32 @@ def test_serialize(self) -> None:
)

self.assertEqual(segments[2].offset + segments[2].size, len(segment_data))

def test_round_trip(self) -> None:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewers: I considered adding a deserialize test in the same vein as the serialize test, but it's a bit awkward to do, in that we'd need to construct a binary input without using the existing serialization logic, Could also include a pre-serialized artifact, but I think this coverage is sufficient in conjunction with the serialize test. Feel free to let me know if you want to see more coverage.

@GregoryComer GregoryComer added the release notes: none Do not include this in the release notes label Jun 18, 2025
@GregoryComer GregoryComer force-pushed the flat-tensor-deserialize branch from 1422bfe to 7a33ea8 Compare June 18, 2025 05:09
@GregoryComer GregoryComer marked this pull request as ready for review June 18, 2025 06:18
@GregoryComer GregoryComer requested a review from lucylq as a code owner June 18, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants