Reads the contents of the GraphDef from either the frozen graph file or the SavedModel directory. If it reads the SavedModel directory, it updates the ModelFlags and TocoFlags accordingly.
| 53 | // SavedModel directory. If it reads the SavedModel directory, it updates the |
| 54 | // ModelFlags and TocoFlags accordingly. |
| 55 | void ReadInputData(const ParsedTocoFlags& parsed_toco_flags, |
| 56 | const ParsedModelFlags& parsed_model_flags, |
| 57 | TocoFlags* toco_flags, ModelFlags* model_flags, |
| 58 | string* graph_def_contents) { |
| 59 | port::CheckInitGoogleIsDone("InitGoogle is not done yet.\n"); |
| 60 | |
| 61 | // Ensure savedmodel_directory is not set. |
| 62 | QCHECK(!parsed_toco_flags.savedmodel_directory.specified()) |
| 63 | << "Use `tensorflow/lite/python/tflite_convert` script with " |
| 64 | << "SavedModel directories.\n"; |
| 65 | |
| 66 | // Checks the input file permissions and reads the contents. |
| 67 | CheckFrozenModelPermissions(parsed_toco_flags.input_file); |
| 68 | CHECK(port::file::GetContents(parsed_toco_flags.input_file.value(), |
| 69 | graph_def_contents, port::file::Defaults()) |
| 70 | .ok()); |
| 71 | } |
| 72 | } // namespace |
| 73 | |
| 74 | tensorflow::Status Convert(const string& graph_def_contents, |
no test coverage detected