xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/serialization/import_export_helpers.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 namespace caffe2::serialize {
7 class PyTorchStreamReader;
8 }
9 
10 namespace torch::jit {
11 
12 struct Source;
13 
14 // Convert a class type's qualifier name to the corresponding path the source
15 // file it should be written to.
16 //
17 // Qualifier is like: foo.bar.baz
18 // Returns: libs/foo/bar/baz.py
19 std::string qualifierToArchivePath(
20     const std::string& qualifier,
21     const std::string& export_prefix);
22 
23 std::shared_ptr<Source> findSourceInArchiveFromQualifier(
24     caffe2::serialize::PyTorchStreamReader& reader,
25     const std::string& export_prefix,
26     const std::string& qualifier);
27 
28 } // namespace torch::jit
29