Fix bug in flatbuffer deserialization

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78344

Approved by: https://github.com/qihqi
This commit is contained in:
Tugsbayasgalan Manlaibaatar
2022-05-26 00:24:27 -07:00
committed by PyTorch MergeBot
parent f42b42d3eb
commit 7e72c96b10
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -16,6 +16,7 @@
#include <torch/csrc/jit/mobile/module.h>
#include <torch/csrc/jit/mobile/parse_bytecode.h>
#include <torch/csrc/jit/mobile/parse_operators.h>
#include <torch/csrc/jit/operator_upgraders/upgraders.h>
#include <torch/csrc/jit/serialization/export.h>
#include <torch/csrc/jit/serialization/export_bytecode.h>
#include <torch/csrc/jit/serialization/flatbuffer_serializer.h>
@@ -837,6 +838,7 @@ TEST(FlatbufferTest, DuplicateSetState) {
auto buff = save_mobile_module_to_bytes(bc);
mobile::Module bc2 = parse_mobile_module(buff.data(), buff.size());
ASSERT_TRUE(torch::jit::is_upgraders_map_populated());
const auto methods2 = bc.get_methods();
ASSERT_EQ(methods2.size(), expected_n);
}