10 #include <c10/core/Allocator.h> 11 #include <c10/core/Backend.h> 13 #include "caffe2/core/logging.h" 14 #include "caffe2/serialize/istream_adapter.h" 15 #include "caffe2/serialize/read_adapter_interface.h" 18 typedef struct mz_zip_archive mz_zip_archive;
92 constexpr uint64_t kMinSupportedFileFormatVersion = 0x1L;
93 constexpr uint64_t kMaxSupportedFileFormatVersion = 0x1L;
96 constexpr uint64_t kFileFormatVersion = 0x2L;
99 constexpr uint64_t kFieldAlignment = 64;
108 std::tuple<at::DataPtr, size_t> getRecord(
const std::string& name);
110 size_t getRecordOffset(
const std::string& name);
116 size_t read(uint64_t pos,
char* buf,
size_t n);
117 void valid(
const char* what);
118 size_t getFileID(
const std::string& name);
121 istream_read_func(
void* pOpaque, uint64_t file_ofs,
void* pBuf,
size_t n);
122 std::unique_ptr<mz_zip_archive> ar_;
123 std::string archive_name_;
124 std::unique_ptr<ReadAdapterInterface> in_;
133 void writeRecord(
const std::string& name,
const void* data,
size_t size);
134 void writeEndOfFile();
136 bool finalized()
const {
140 const std::string& archiveName() {
141 return archive_name_;
147 void valid(
const char* what);
148 size_t current_pos_ = 0;
149 std::unique_ptr<mz_zip_archive> ar_;
150 std::string archive_name_;
152 std::ofstream file_stream_;
153 bool finalized_ =
false;
154 friend size_t ostream_write_func(
void *pOpaque, uint64_t file_ofs,
const void *pBuf,
size_t n);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...