/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/serialization
NameSizeModeActions
callstack_debug_info_serialization.h26240644editdlrm
export.h98390644editdlrm
import.h33500644editdlrm
import_export_constants.h6700644editdlrm
import_export_functions.h4060644editdlrm
import_export_helpers.h7090644editdlrm
import_legacy.h4960644editdlrm
import_read.h7830644editdlrm
import_source.h33420644editdlrm
onnx.h2290644editdlrm
pickle.h30870644editdlrm
pickler.h85880644editdlrm
python_print.h11800644editdlrm
source_range_serialization.h11980644editdlrm
source_range_serialization_impl.h6850644editdlrm
storage_context.h24840644editdlrm
type_name_uniquer.h7790644editdlrm
unpickler.h64340644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/serialization/import_source.h (3342B)
#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace torch { namespace jit { using SourceLoader = std::function(const std::string&)>; struct SourceImporterImpl : public Resolver, std::enable_shared_from_this { SourceImporterImpl( std::shared_ptr cu, const std::vector* constant_table, SourceLoader source_loader, size_t version); TypePtr findNamedType(const QualifiedName& name); Function* findFunction(const QualifiedName& name); void parseSourceIfNeeded(const std::string& qualifier); void LEGACY_import_methods( const Module& mod, const std::shared_ptr& src); std::shared_ptr resolveValue( const std::string& name, Function& m, const SourceRange& loc) override; TypePtr resolveType(const std::string& name, const SourceRange& loc) override; private: void importFunction(const std::string& qualifier, const Def& def); void importNamedType(const std::string& qualifier, const ClassDef& class_def); c10::optional attributeAssignmentSpecialHandlingHack( const QualifiedName& qualified_classname, const Assign& assign); void importClass( const QualifiedName& qualified_classname, const ClassDef& class_def, bool is_module); void importEnum( const QualifiedName& qualified_name, const ClassDef& enum_def); void importNamedTuple( const QualifiedName& qualified_name, const ClassDef& named_tuple_def); void parsePossibleVersionNumber(Lexer& L); void parseImports(Lexer& L); std::shared_ptr cu_; std::unordered_map> env_; SourceLoader source_loader_; std::unordered_set loaded_sources_; // named types and functions loaded from a file but not yet defined because // their type has not been requested yet. std::unordered_map to_be_defined_; }; // Given a directory of serialized TorchScript sources, // This class allows the loading of individual named types in source. // Resolves the dependencies between source files and parses // the source files as necessary. struct TORCH_API SourceImporter { SourceImporter( // The compilation unit that will own the imported source std::shared_ptr cu, const std::vector* constant_table, SourceLoader loader, size_t version); TypePtr loadType(const QualifiedName& name) const; // Add the methods defined in `src` to the module `mod`, using SourceImporter // to resolve any classes via loadType void LEGACY_import_methods( const Module& mod, const std::shared_ptr& src); ~SourceImporter(); private: std::shared_ptr pImpl; }; } // namespace jit } // namespace torch