TensorFlow教程之API DOC 6.1.17 TensorFlow C++ Session API reference documentation

    xiaoxiao2021-04-19  309

    本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权。

    TensorFlow C++ Session API reference documentation

    TensorFlow's public C++ API includes only the API for executing graphs, as of version 0.5. To control the execution of a graph from C++:

    Build the computation graph using the Python API.Use tf.train.write_graph() to write the graph to a file.

    Load the graph using the C++ Session API. For example:

    // Reads a model graph definition from disk, and creates a session object you // can use to run it. Status LoadGraph(string graph_file_name, Session** session) { GraphDef graph_def; TF_RETURN_IF_ERROR( ReadBinaryProto(Env::Default(), graph_file_name, &graph_def)); TF_RETURN_IF_ERROR(NewSession(SessionOptions(), session)); TF_RETURN_IF_ERROR((*session)->Create(graph_def)); return Status::OK(); }

    Run the graph with a call to session->Run()

    Classes

    tensorflow::Envtensorflow::EnvWrappertensorflow::RandomAccessFiletensorflow::Sessiontensorflow::Statustensorflow::Tensortensorflow::TensorBuffertensorflow::TensorShapetensorflow::TensorShapeItertensorflow::TensorShapeUtilstensorflow::Threadtensorflow::WritableFile

    Structs

    tensorflow::SessionOptionstensorflow::Status::Statetensorflow::TensorShapeDimtensorflow::ThreadOptions

    最新回复(0)