Loads a model from `filename`. If `mmap_file` is true then use mmap, otherwise make a copy of the model in a buffer.
| 63 | // Loads a model from `filename`. If `mmap_file` is true then use mmap, |
| 64 | // otherwise make a copy of the model in a buffer. |
| 65 | std::unique_ptr<Allocation> GetAllocationFromFile(const char* filename, |
| 66 | bool mmap_file, |
| 67 | ErrorReporter* error_reporter, |
| 68 | bool use_nnapi) { |
| 69 | std::unique_ptr<Allocation> allocation; |
| 70 | if (mmap_file && MMAPAllocation::IsSupported()) { |
| 71 | allocation.reset(new MMAPAllocation(filename, error_reporter)); |
| 72 | } else { |
| 73 | allocation.reset(new FileCopyAllocation(filename, error_reporter)); |
| 74 | } |
| 75 | return allocation; |
| 76 | } |
| 77 | |
| 78 | std::unique_ptr<FlatBufferModel> FlatBufferModel::BuildFromFile( |
| 79 | const char* filename, ErrorReporter* error_reporter) { |
no test coverage detected