[pytorch][PR] Add ability for a mobile::Module to save as flatbuffer (#70201)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70201

Included functions:
save_mobile_module -> saves a mobile::Module to flatbuffer
load_mobile_module_from_file -> loads a flatbuffer into mobile::Module
parse_mobile_module -> parses from bytes or deserialized flatbuffer module object

Compared to previous attempts, this diff only adds flatbuffer to cmake target and leaves fbcode/xplat ones unchanged.

Test Plan: unittest

Reviewed By: malfet, gmagogsfm

Differential Revision: D33239362

fbshipit-source-id: b9ca36b83d6af2d78cc50b9eb9e2a6fa7fce0763
This commit is contained in:
Han Qi
2022-01-12 16:27:21 -08:00
committed by Facebook GitHub Bot
parent 7a93d8bb2d
commit 1bc3571078
20 changed files with 5132 additions and 2 deletions

View File

@ -197,3 +197,8 @@ new_local_repository(
build_file = "@//third_party:cudnn.BUILD",
path = "/usr/",
)
local_repository(
name = "com_github_google_flatbuffers",
path = "third_party/flatbuffers",
)