| 63 | } |
| 64 | |
| 65 | void TF_NewWritableFile(const char* filename, TF_WritableFileHandle** handle, |
| 66 | TF_Status* status) { |
| 67 | std::unique_ptr<::tensorflow::WritableFile> f; |
| 68 | TF_SetStatus(status, TF_OK, ""); |
| 69 | ::tensorflow::Status s = |
| 70 | ::tensorflow::Env::Default()->NewWritableFile(filename, &f); |
| 71 | ::tensorflow::Set_TF_Status_from_Status(status, s); |
| 72 | |
| 73 | if (s.ok()) { |
| 74 | *handle = reinterpret_cast<TF_WritableFileHandle*>(f.release()); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void TF_CloseWritableFile(TF_WritableFileHandle* handle, TF_Status* status) { |
| 79 | auto* cc_file = reinterpret_cast<::tensorflow::WritableFile*>(handle); |