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

本文档为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++:

  1. Build the computation graph using the Python API.
  2. Use tf.train.write_graph() to write the graph to a file.
  3. 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();
    }
    
  4. Run the graph with a call to session->Run()

Classes

Structs

时间: 2024-11-03 20:41:05

TensorFlow教程之API DOC 6.1.17 TensorFlow C++ Session API reference documentation的相关文章

TensorFlow教程之API DOC 6.3.5. FRAMEWORK

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Building Graphs Contents Building Graphs Core graph data structures class tf.Graph class tf.Operation class tf.Tensor Tensor types class tf.DType tf.as_dtype(type_value) Utility functions tf.device(dev) tf.n

TensorFlow教程之API DOC 6.3.7. INDEX

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. TensorFlow Python reference documentation Building Graphs: add_to_collection as_dtype control_dependencies convert_to_tensor device Dimension DType get_collection get_default_graph get_seed Graph GraphKeys i

TensorFlow教程之API DOC 6.3.2. CLIENT

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Running Graphs Contents Running Graphs Session management class tf.Session class tf.InteractiveSession tf.get_default_session() Error classes class tf.OpError class tf.errors.CancelledError class tf.errors.U

TensorFlow教程之API DOC 6.1.6 Class tensorflow::Tensor

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Class tensorflow::Tensor Represents an n-dimensional array of values. Member Summary tensorflow::Tensor::Tensor() Default Tensor constructor. Creates a 1-dimension, 0-element float tensor. tensorflow::Tensor

TensorFlow教程之API DOC 6.1.5 Class tensorflow::Status

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Class tensorflow::Status Member Summary tensorflow::Status::Status() Create a success status. tensorflow::Status::~Status() tensorflow::Status::Status(tensorflow::error::Code code, tensorflow::StringPiece ms

TensorFlow教程之API DOC 6.1.8 Class tensorflow::TensorShape

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Class tensorflow::TensorShape Manages the dimensions of a Tensor and their sizes. Member Summary tensorflow::TensorShape::TensorShape(gtl::ArraySlice< int64 > dim_sizes) Construct a TensorShape from the pro

TensorFlow教程之API DOC 6.1.7 Class tensorflow::TensorBuffer

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Class tensorflow::TensorBuffer Member Summary tensorflow::TensorBuffer::~TensorBuffer() override virtual void* tensorflow::TensorBuffer::data() const =0 virtual size_t tensorflow::TensorBuffer::size() const

TensorFlow教程之API DOC 6.1.10 Class tensorflow::TensorShapeUtils

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Class tensorflow::TensorShapeUtils Static helper routines for TensorShape. Includes a few common predicates on a tensor shape. Member Summary static bool tensorflow::TensorShapeUtils::IsScalar(const TensorSh

TensorFlow教程之API DOC 6.1.13 Struct tensorflow::SessionOptions

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权. Configuration information for a Session . Member Summary Env* tensorflow::SessionOptions::env The environment to use. string tensorflow::SessionOptions::target The TensorFlow runtime to connect to. ConfigPro