main.cc
// Takes a file name, and loads a list of labels from it, one per line, and
// returns a vector of the strings. It pads with empty strings so the length
// of the result is a multiple of 16, because our model expects that.
Takes a file name, and loads a list of labels from it, one per line, and
returns a vector of the strings. It pads with empty strings so the length
of the result is a multiple of 16, because our model expects that.
Takes a file name and loads a list of labels from it one per line and returns a vector of the strings . It pads with empty strings so the length of the result is a multiple of 16 because our model expects that .
Status ReadLabelsFile(const string &file_name, std::vector<string> *result,
                      size_t *found_label_count) {
  std::ifstream file(file_name);
  if (!file) {
    return tensorflow::errors::NotFound("Labels file ", file_name,
                                        " not found.");
  }
  result->clear();
  string line;
  while (std::getline(file, line)) {
    result->push_back(line);
  }
  *found_label_count = result->size();
  const int padding = 16;
  while (result->size() % padding) {
    result->emplace_back();
  }
  return Status::OK();
}
Status ReadLabelsFile ( const string & file_name , std :: vector < string > * result , size_t * found_label_count ) { std :: ifstream file ( file_name ) ; if ( ! file ) { return tensorflow :: errors :: NotFound ( " " , file_name , " " ) ; } result -> clear ( ) ; string line ; while ( std :: getline ( file , line ) ) { result -> push_back ( line ) ; } * found_label_count = result -> size ( ) ; const int padding = 16 ; while ( result -> size ( ) % padding ) { result -> emplace_back ( ) ; } return Status :: OK ( ) ; }
Takes a file name, and loads a list of labels from it, one per line, and
returns a vector of the strings.
Takes a file name and loads a list of labels from it one per line and returns a vector of the strings .