MCPcopy Create free account
hub / github.com/dmlc/parameter_server / readMatricesFromText

Method readMatricesFromText

src/data/stream_reader.h:162–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160
161template<typename V>
162bool StreamReader<V>::readMatricesFromText() { // uint32 num_ex, MatrixPtrList<V>* mat) {
163 uint32 num_read = 0;
164 while (num_read < num_examples_ && !reach_data_end_) {
165 while (true) {
166 // read a line
167 char* result = data_file_->readLine(line_, kMaxLineLength_);
168 if (result != nullptr) {
169 // Chop the last linefeed if present.
170 int len = strlen(result);
171 if (len > 0 && result[len - 1] == '\n') { // Linefeed.
172 result[--len] = '\0';
173 }
174 if (len > 0 && result[len - 1] == '\r') { // Carriage return.
175 result[--len] = '\0';
176 }
177 Example ex;
178 if (!text_parser_.toProto(result, &ex)) continue;
179 parseExample(ex, num_read);
180 ++ num_read;
181 break;
182 } else {
183 if (!openNextFile()) break;
184 }
185 }
186 }
187 // LL << num_read << " " << reach_data_end_;
188 fillMatrices();
189 return !reach_data_end_;
190}
191
192template<typename V>
193bool StreamReader<V>::readMatrices(

Callers

nothing calls this directly

Calls 2

readLineMethod · 0.80
toProtoMethod · 0.80

Tested by

no test coverage detected