Class OutputArchive

Page Contents

Class Documentation

class OutputArchive

Public Functions

explicit OutputArchive(std::shared_ptr<jit::CompilationUnit> cu)
inline explicit OutputArchive()
OutputArchive(OutputArchive&&) = default
OutputArchive &operator=(OutputArchive&&) = default
OutputArchive(OutputArchive&) = delete
OutputArchive &operator=(OutputArchive&) = delete
inline std::shared_ptr<jit::CompilationUnit> compilation_unit() const
void write(const std::string &key, const c10::IValue &ivalue)

Writes an IValue to the OutputArchive.

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-differentiable tensor).

void write(const std::string &key, OutputArchive &nested_archive)

Writes a nested OutputArchive under the given key to this OutputArchive.

void save_to(const std::string &filename)

Saves the OutputArchive into a serialized representation in a file at filename.

void save_to(std::ostream &stream)

Saves the OutputArchive into a serialized representation into the given stream.

void save_to(const std::function<size_t(const void*, size_t)> &func)

Saves the OutputArchive into a serialized representation using the given writer function.

template<typename ...Ts>
inline void operator()(Ts&&... ts)

Forwards all arguments to write().

Useful for generic code that can be re-used for both OutputArchive and InputArchive (where operator() forwards to read()).


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources