Software Archive
Read-only legacy content

reading graph data in tensorflow c++ api

dinesh_l_
Beginner
704 Views

How do i read the datas from the file train.pb in current c++ code? I followed some tutorial on tensorflow and understood till this much lines, but after this i cant find exact correct way to read the datas(multidimensional array values) inside the c++ code. i'm studked in my project cas of this.
Session* session;
Status status = NewSession(SessionOptions(), &session);
if (!status.ok()) {
std::cout << status.ToString() << "\n";
return 1;
}

// Read in the protobuf graph we exported
// (The path seems to be relative to the cwd. Keep this in mind
// when using `bazel run` since the cwd isn't where you call
// `bazel run` but from inside a temp folder.)
GraphDef graph_def;
status = ReadBinaryProto(Env::Default(), "models/train.pb", &graph_def);
if (!status.ok()) {
std::cout << status.ToString() << "\n";
return 1;
}

// Add the graph to the session
status = session->Create(graph_def);
if (!status.ok()) {
std::cout << status.ToString() << "\n";
return 1;
}
std::vector<std::pair<string, tensorflow::Tensor>> inputs = " what is here?"

0 Kudos
3 Replies
gaston-hillar
Valued Contributor I
704 Views

Dinesh,

There is a detailed example with code in the following blog post: https://medium.com/jim-fleming/loading-a-tensorflow-graph-with-the-c-api-4caaff88463f#.6wx20arc1

0 Kudos
gaston-hillar
Valued Contributor I
704 Views

Dinesh,

If you are working with TensorFlow, there is going to be a TensorFlow on Modern Intel® Architectures Webinar in May 9, 2017. The following link provides detailed information about the TensorFlow* on Modern Intel® Architectures Webinar

 

0 Kudos
gaston-hillar
Valued Contributor I
704 Views

The speaker for this webinar is ElMoustapha Ould-Ahmed-Vall, Senior Principal Engineer in Artificial Intelligence Products Group (AIPG)

0 Kudos
Reply