Skip to content

Commit

Permalink
[PyTorch Mobile] Add an overload for deserialize() that doesn't accep…
Browse files Browse the repository at this point in the history
…t the extra_files map. (#50932)

Summary:
Pull Request resolved: #50932

After the change to split `_load_for_mobile()` into multiple methods, one which takes in the `extra_files` map, and one which doesn't, we can change the implementation of the `deserialize()` method with different overloads as well. Suggested by raziel on D25968216 (bb909d2).

ghstack-source-id: 120185089

Test Plan: Build/Sandcastle.

Reviewed By: JacobSzwejbka

Differential Revision: D26014084

fbshipit-source-id: 914142137346a6246def1acf38a3204dd4c4f52f
  • Loading branch information
dhruvbird authored and facebook-github-bot committed Jan 23, 2021
1 parent ab331da commit ce0f335
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions torch/csrc/jit/mobile/import.cpp
Expand Up @@ -230,6 +230,7 @@ void parseMethods(
class BytecodeDeserializer final {
public:
explicit BytecodeDeserializer(std::unique_ptr<PyTorchStreamReader> reader);
mobile::Module deserialize(c10::optional<at::Device> device);
mobile::Module deserialize(
c10::optional<at::Device> device,
ExtraFilesMap& extra_files);
Expand Down Expand Up @@ -274,6 +275,12 @@ mobile::Module BytecodeDeserializer::deserialize(
std::string(static_cast<char*>(meta_ptr.get()), meta_size);
}
}
return deserialize(device);
}

mobile::Module BytecodeDeserializer::deserialize(
c10::optional<at::Device> device) {
device_ = device;
auto mcu = std::make_shared<mobile::CompilationUnit>();

// bvals can have 2 possible formats:
Expand Down

0 comments on commit ce0f335

Please sign in to comment.