| 267 | } |
| 268 | |
| 269 | TfLiteStatus InterpreterWriter::Write(const std::string& filename) { |
| 270 | std::unique_ptr<uint8_t[]> buffer; |
| 271 | size_t size; |
| 272 | TF_LITE_ENSURE_STATUS(GetBuffer(&buffer, &size)); |
| 273 | |
| 274 | FILE* fp = fopen(filename.c_str(), "wb"); |
| 275 | if (!fp) return kTfLiteError; |
| 276 | |
| 277 | if (fwrite(buffer.get(), 1, size, fp) != size) return kTfLiteError; |
| 278 | if (fclose(fp)) return kTfLiteError; |
| 279 | |
| 280 | return kTfLiteOk; |
| 281 | } |
| 282 | |
| 283 | TfLiteStatus InterpreterWriter::RegisterCustomWriter( |
| 284 | const std::string& custom_name, CustomWriter custom_writer) { |