Skip to content

Commit 7719f80

Browse files
committed
Add missing std namespace in tensorflow code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 8a6fa45 commit 7719f80

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/lstm/tfnetwork.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace tesseract {
3232

3333
TFNetwork::TFNetwork(const STRING& name) : Network(NT_TENSORFLOW, name, 0, 0) {}
3434

35-
int TFNetwork::InitFromProtoStr(const string& proto_str) {
35+
int TFNetwork::InitFromProtoStr(const std::string& proto_str) {
3636
if (!model_proto_.ParseFromString(proto_str)) return 0;
3737
return InitFromProto();
3838
}
@@ -41,7 +41,7 @@ int TFNetwork::InitFromProtoStr(const string& proto_str) {
4141
// Should be overridden by subclasses, but called by their Serialize.
4242
bool TFNetwork::Serialize(TFile* fp) const {
4343
if (!Network::Serialize(fp)) return false;
44-
string proto_str;
44+
std::string proto_str;
4545
model_proto_.SerializeToString(&proto_str);
4646
GenericVector<char> data;
4747
data.resize_no_init(proto_str.size());
@@ -66,7 +66,7 @@ bool TFNetwork::DeSerialize(TFile* fp) {
6666
void TFNetwork::Forward(bool debug, const NetworkIO& input,
6767
const TransposedArray* input_transpose,
6868
NetworkScratch* scratch, NetworkIO* output) {
69-
std::vector<std::pair<string, Tensor>> tf_inputs;
69+
std::vector<std::pair<std::string, Tensor>> tf_inputs;
7070
int depth = input_shape_.depth();
7171
ASSERT_HOST(depth == input.NumFeatures());
7272
// TODO(rays) Allow batching. For now batch_size = 1.
@@ -101,7 +101,7 @@ void TFNetwork::Forward(bool debug, const NetworkIO& input,
101101
*eigen_htensor.data() = stride_map.Size(FD_HEIGHT);
102102
tf_inputs.emplace_back(model_proto_.image_heights(), height_tensor);
103103
}
104-
std::vector<string> target_layers = {model_proto_.output_layer()};
104+
std::vector<std::string> target_layers = {model_proto_.output_layer()};
105105
std::vector<Tensor> outputs;
106106
Status s = session_->Run(tf_inputs, target_layers, {}, &outputs);
107107
if (!s.ok()) tprintf("session->Run failed:%s\n", s.error_message().c_str());

src/lstm/tfnetwork.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class TFNetwork : public Network {
5050

5151
// Deserializes *this from a serialized TFNetwork proto. Returns 0 if failed,
5252
// otherwise the global step of the serialized graph.
53-
int InitFromProtoStr(const string& proto_str);
53+
int InitFromProtoStr(const std::string& proto_str);
5454
// The number of classes in this network should be equal to those in the
5555
// recoder_ in LSTMRecognizer.
5656
int num_classes() const { return output_shape_.depth(); }
@@ -72,7 +72,7 @@ class TFNetwork : public Network {
7272
int InitFromProto();
7373

7474
// The original network definition for reference.
75-
string spec_;
75+
std::string spec_;
7676
// Input tensor parameters.
7777
StaticShape input_shape_;
7878
// Output tensor parameters.

0 commit comments

Comments
 (0)