blob: ddbdd72e164974871c49ebc14ec626cac1b773a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# TensorFlow C++ Session API reference documentation <a class="md-anchor" id="AUTOGENERATED-tensorflow-c---session-api-reference-documentation"></a>
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](../../api_docs/python/).
1. Use [tf.train.write_graph()](../../api_docs/python/train.md#write_graph) to
write the graph to a file.
1. Load the graph using the C++ Session API. For example:
```c++
// 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();
}
```
1. Run the graph with a call to `session->Run()`
## Env <a class="md-anchor" id="AUTOGENERATED-env"></a>
* [tensorflow::Env](../../api_docs/cc/ClassEnv.md)
* [tensorflow::RandomAccessFile](../../api_docs/cc/ClassRandomAccessFile.md)
* [tensorflow::WritableFile](../../api_docs/cc/ClassWritableFile.md)
* [tensorflow::EnvWrapper](../../api_docs/cc/ClassEnvWrapper.md)
## Session <a class="md-anchor" id="AUTOGENERATED-session"></a>
* [tensorflow::Session](../../api_docs/cc/ClassSession.md)
* [tensorflow::SessionOptions](../../api_docs/cc/StructSessionOptions.md)
## Status <a class="md-anchor" id="AUTOGENERATED-status"></a>
* [tensorflow::Status](../../api_docs/cc/ClassStatus.md)
* [tensorflow::Status::State](../../api_docs/cc/StructState.md)
## Tensor <a class="md-anchor" id="AUTOGENERATED-tensor"></a>
* [tensorflow::Tensor](../../api_docs/cc/ClassTensor.md)
* [tensorflow::TensorShape](../../api_docs/cc/ClassTensorShape.md)
* [tensorflow::TensorShapeDim](../../api_docs/cc/StructTensorShapeDim.md)
* [tensorflow::TensorShapeUtils](../../api_docs/cc/ClassTensorShapeUtils.md)
## Thread <a class="md-anchor" id="AUTOGENERATED-thread"></a>
* [tensorflow::Thread](../../api_docs/cc/ClassThread.md)
* [tensorflow::ThreadOptions](../../api_docs/cc/StructThreadOptions.md)
<div class='sections-order' style="display: none;">
<!--
<!-- ClassEnv.md -->
<!-- ClassRandomAccessFile.md -->
<!-- ClassWritableFile.md -->
<!-- ClassEnvWrapper.md -->
<!-- ClassSession.md -->
<!-- StructSessionOptions.md -->
<!-- ClassStatus.md -->
<!-- StructState.md -->
<!-- ClassTensor.md -->
<!-- ClassTensorShape.md -->
<!-- StructTensorShapeDim.md -->
<!-- ClassTensorShapeUtils.md -->
<!-- ClassThread.md -->
<!-- StructThreadOptions.md -->
-->
</div>
|