1 #include <torch/serialize/output-archive.h> 3 #include <torch/types.h> 4 #include <torch/utils.h> 6 #include <torch/csrc/jit/export.h> 7 #include <torch/csrc/jit/script/module.h> 9 #include <c10/util/Exception.h> 18 : module_(
std::make_shared<jit::script::Module>()) {}
21 const std::string& key,
24 module_->register_parameter(key, tensor, is_buffer);
28 const std::string& key,
30 module_->register_module(key, nested_archive.module_);
34 AT_ASSERT(module_ !=
nullptr);
35 jit::ExportModule(*module_, filename);
39 AT_ASSERT(module_ !=
nullptr);
40 jit::ExportModule(*module_, stream);
void write(const std::string &key, const Tensor &tensor, bool is_buffer=false)
Writes a (key, tensor) pair to the OutputArchive, and marks it as being or not being a buffer (non-di...
OutputArchive()
Default-constructs the OutputArchive.
void save_to(const std::string &filename)
Saves the OutputArchive into a serialized representation in a file at filename.