| 519 | } |
| 520 | |
| 521 | Status WriteTextProto(Env* env, const string& fname, |
| 522 | const ::tensorflow::protobuf::Message& proto) { |
| 523 | #if !defined(TENSORFLOW_LITE_PROTOS) |
| 524 | string serialized; |
| 525 | if (!::tensorflow::protobuf::TextFormat::PrintToString(proto, &serialized)) { |
| 526 | return errors::FailedPrecondition("Unable to convert proto to text."); |
| 527 | } |
| 528 | return WriteStringToFile(env, fname, serialized); |
| 529 | #else |
| 530 | return errors::Unimplemented("Can't write text protos with protolite."); |
| 531 | #endif |
| 532 | } |
| 533 | |
| 534 | Status ReadTextProto(Env* env, const string& fname, |
| 535 | ::tensorflow::protobuf::Message* proto) { |