| 92 | } |
| 93 | |
| 94 | Status RunStep(const string& handle, |
| 95 | const std::vector<std::pair<string, const Tensor*> >& feed, |
| 96 | const std::map<string, Tensor*>& fetch) { |
| 97 | ::grpc::ClientContext ctx; |
| 98 | RunStepRequest req; |
| 99 | req.set_session_handle(handle); |
| 100 | for (const auto& p : feed) { |
| 101 | const string& feed_name = p.first; |
| 102 | const Tensor* feed_tensor = p.second; |
| 103 | auto f = req.add_feed(); |
| 104 | f->set_name(feed_name); |
| 105 | feed_tensor->AsProtoTensorContent(f->mutable_tensor()); |
| 106 | } |
| 107 | for (const auto& p : fetch) { |
| 108 | const string& fetch_name = p.first; |
| 109 | req.add_fetch(fetch_name); |
| 110 | } |
| 111 | RunStepResponse resp; |
| 112 | const Status s = FromGrpcStatus(master_->RunStep(&ctx, req, &resp)); |
| 113 | if (s.ok()) { |
| 114 | for (const auto& fetch_resp : resp.tensor()) { |
| 115 | auto it = fetch.find(fetch_resp.name()); |
| 116 | CHECK(it != fetch.end()); |
| 117 | CHECK(it->second->FromProto(fetch_resp.tensor())); |
| 118 | } |
| 119 | } |
| 120 | return s; |
| 121 | } |
| 122 | |
| 123 | Status CloseSession(const string& handle) { |
| 124 | ::grpc::ClientContext ctx; |
nothing calls this directly
no test coverage detected