mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69306 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 Test Plan: unittests Reviewed By: gmagogsfm Differential Revision: D32806835 fbshipit-source-id: 71913c6650e225634f878946bd16960d377a7f57
27 lines
810 B
Bash
Executable File
27 lines
810 B
Bash
Executable File
#!/bin/bash
|
|
echo "Running gen_flatbuffers.sh OSTYPE is $OSTYPE"
|
|
ROOT=$(pwd)
|
|
FF_LOCATION="$ROOT/third_party/flatbuffers"
|
|
cd "$FF_LOCATION" || exit
|
|
mkdir build
|
|
cd build || exit
|
|
py() { command python "$@"; }
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
echo "Current arch is $CMAKE_OSX_ARCHITECTURES"
|
|
printenv
|
|
echo "====================="
|
|
cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 ..
|
|
cmake --build . --target flatc
|
|
FLATC=./Debug/flatc
|
|
else
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
cmake --build . --target flatc
|
|
FLATC=./flatc
|
|
fi
|
|
mkdir -p "$ROOT/build/torch/csrc/jit/serialization"
|
|
$FLATC --cpp --gen-mutable --scoped-enums \
|
|
-o "$ROOT/build/torch/csrc/jit/serialization" \
|
|
-c "$ROOT/torch/csrc/jit/serialization/mobile_bytecode.fbs"
|
|
cd "$ROOT" || exit
|
|
exit
|