1 #include "caffe2/serialize/file_adapter.h" 2 #include <c10/util/Exception.h> 3 #include "caffe2/core/common.h" 8 FileAdapter::FileAdapter(
const std::string& file_name) {
9 file_stream_.open(file_name, std::ifstream::in | std::ifstream::binary);
11 AT_ERROR(
"open file failed, file path: ", file_name);
13 istream_adapter_ = caffe2::make_unique<IStreamAdapter>(&file_stream_);
16 size_t FileAdapter::size()
const {
17 return istream_adapter_->size();
20 size_t FileAdapter::read(uint64_t pos,
void* buf,
size_t n,
const char* what)
22 return istream_adapter_->read(pos, buf, n, what);
25 FileAdapter::~FileAdapter() {}
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...