main.cc
// Reads a model graph definition from disk, and creates a session object you
// can use to run it.
Reads a model graph definition from disk, and creates a session object you
can use to run it.
Reads a model graph definition from disk and creates a session object you can use to run it .
Status LoadGraph(const string &graph_file_name,
                 std::unique_ptr<tensorflow::Session> *session) {
  std::cout << "[Status] start loading model" << std::endl;
  tensorflow::GraphDef graph_def;
  Status load_graph_status =
      ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
  if (!load_graph_status.ok()) {
    return tensorflow::errors::NotFound("Failed to load compute graph at '",
                                        graph_file_name, "'");
  }
  session->reset(tensorflow::NewSession(tensorflow::SessionOptions()));
  Status session_create_status = (*session)->Create(graph_def);
  if (!session_create_status.ok()) {
    return session_create_status;
  }
  return Status::OK();
}
Status LoadGraph ( const string & graph_file_name , std :: unique_ptr < tensorflow :: Session > * session ) { std :: cout << " " << std :: endl ; tensorflow :: GraphDef graph_def ; Status load_graph_status = ReadBinaryProto ( tensorflow :: Env :: Default ( ) , graph_file_name , & graph_def ) ; if ( ! load_graph_status . ok ( ) ) { return tensorflow :: errors :: NotFound ( " " , graph_file_name , " " ) ; } session -> reset ( tensorflow :: NewSession ( tensorflow :: SessionOptions ( ) ) ) ; Status session_create_status = ( * session ) -> Create ( graph_def ) ; if ( ! session_create_status . ok ( ) ) { return session_create_status ; } return Status :: OK ( ) ; }
Reads a model graph definition from disk, and creates a session object you
can use to run it.
Reads a model graph definition from disk and creates a session object you can use to run it .
// declare the graph // the actual load process: ReadBinaryProto // reset // feed the model to session