Merge pull request #2139 from stweil/tensorflow

Add missing std namespace in tensorflow code
This commit is contained in:
zdenop 2019-01-03 11:49:51 +01:00 committed by GitHub
commit 3377ed2e25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ namespace tesseract {
TFNetwork::TFNetwork(const STRING& name) : Network(NT_TENSORFLOW, name, 0, 0) {}
int TFNetwork::InitFromProtoStr(const string& proto_str) {
int TFNetwork::InitFromProtoStr(const std::string& proto_str) {
if (!model_proto_.ParseFromString(proto_str)) return 0;
return InitFromProto();
}
@ -41,7 +41,7 @@ int TFNetwork::InitFromProtoStr(const string& proto_str) {
// Should be overridden by subclasses, but called by their Serialize.
bool TFNetwork::Serialize(TFile* fp) const {
if (!Network::Serialize(fp)) return false;
string proto_str;
std::string proto_str;
model_proto_.SerializeToString(&proto_str);
GenericVector<char> data;
data.resize_no_init(proto_str.size());
@ -66,7 +66,7 @@ bool TFNetwork::DeSerialize(TFile* fp) {
void TFNetwork::Forward(bool debug, const NetworkIO& input,
const TransposedArray* input_transpose,
NetworkScratch* scratch, NetworkIO* output) {
std::vector<std::pair<string, Tensor>> tf_inputs;
std::vector<std::pair<std::string, Tensor>> tf_inputs;
int depth = input_shape_.depth();
ASSERT_HOST(depth == input.NumFeatures());
// TODO(rays) Allow batching. For now batch_size = 1.
@ -101,7 +101,7 @@ void TFNetwork::Forward(bool debug, const NetworkIO& input,
*eigen_htensor.data() = stride_map.Size(FD_HEIGHT);
tf_inputs.emplace_back(model_proto_.image_heights(), height_tensor);
}
std::vector<string> target_layers = {model_proto_.output_layer()};
std::vector<std::string> target_layers = {model_proto_.output_layer()};
std::vector<Tensor> outputs;
Status s = session_->Run(tf_inputs, target_layers, {}, &outputs);
if (!s.ok()) tprintf("session->Run failed:%s\n", s.error_message().c_str());

View File

@ -50,7 +50,7 @@ class TFNetwork : public Network {
// Deserializes *this from a serialized TFNetwork proto. Returns 0 if failed,
// otherwise the global step of the serialized graph.
int InitFromProtoStr(const string& proto_str);
int InitFromProtoStr(const std::string& proto_str);
// The number of classes in this network should be equal to those in the
// recoder_ in LSTMRecognizer.
int num_classes() const { return output_shape_.depth(); }
@ -72,7 +72,7 @@ class TFNetwork : public Network {
int InitFromProto();
// The original network definition for reference.
string spec_;
std::string spec_;
// Input tensor parameters.
StaticShape input_shape_;
// Output tensor parameters.