| 33 | namespace tools { |
| 34 | |
| 35 | void RealMain(const string& mode, const string& path) { |
| 36 | HloSnapshot module; |
| 37 | tensorflow::Env* env = tensorflow::Env::Default(); |
| 38 | if (mode == "txt2bin") { |
| 39 | TF_CHECK_OK(tensorflow::ReadTextProto(env, path, &module)); |
| 40 | TF_CHECK_OK(tensorflow::WriteBinaryProto(env, path, module)); |
| 41 | } else if (mode == "bin2txt") { |
| 42 | TF_CHECK_OK(tensorflow::ReadBinaryProto(env, path, &module)); |
| 43 | string out; |
| 44 | tensorflow::protobuf::TextFormat::PrintToString(module, &out); |
| 45 | fprintf(stdout, "%s", out.c_str()); |
| 46 | } else { |
| 47 | LOG(QFATAL) << "unknown mode for computation conversion: " << mode; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | } // namespace tools |
| 52 | } // namespace xla |
no test coverage detected