Skip to content

Commit

Permalink
Add missing std namespace in tensorflow code
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jan 3, 2019
1 parent 8a6fa45 commit 7719f80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lstm/tfnetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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());
Expand All @@ -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.
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions src/lstm/tfnetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand All @@ -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.
Expand Down

0 comments on commit 7719f80

Please sign in to comment.