Class OutputArchive
Defined in File output-archive.h
Page Contents
Class Documentation
-
class OutputArchive
Public Functions
-
OutputArchive(OutputArchive&&) = default
-
OutputArchive &operator=(OutputArchive&&) = default
-
OutputArchive(OutputArchive&) = delete
-
OutputArchive &operator=(OutputArchive&) = delete
-
void write(const std::string &key, const c10::IValue &ivalue)
Writes an
IValue
to theOutputArchive
.
-
void write(const std::string &key, const Tensor &tensor, bool is_buffer = false)
Writes a
(key, tensor)
pair to theOutputArchive
, 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 givenkey
to thisOutputArchive
.
-
void save_to(const std::string &filename)
Saves the
OutputArchive
into a serialized representation in a file atfilename
.
-
void save_to(std::ostream &stream)
Saves the
OutputArchive
into a serialized representation into the givenstream
.
-
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
andInputArchive
(whereoperator()
forwards toread()
).
-
OutputArchive(OutputArchive&&) = default