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

Method parseExample

src/data/stream_reader.h:93–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91
92template<typename V>
93void StreamReader<V>::parseExample(const Example& ex, int num_read) {
94 if (examples_) examples_->push_back(ex);
95 if (!matrices_) return;
96 if (!info_parser_.add(ex)) return;
97 // store them in slots
98 for (int i = 0; i < ex.slot_size(); ++i) {
99 const auto& slot = ex.slot(i);
100 CHECK_LT(slot.id(), kSlotIDmax);
101 auto& vslot = vslots_[slot.id()];
102 int key_size = slot.key_size();
103 for (int j = 0; j < key_size; ++j) vslot.col_idx.pushBack(slot.key(j));
104 int val_size = slot.val_size();
105 for (int j = 0; j < val_size; ++j) {
106 vslot.val.pushBack(slot.val(j));
107 }
108 while (vslot.row_siz.size() < num_read) vslot.row_siz.pushBack(0);
109 vslot.row_siz.pushBack(std::max(key_size, val_size));
110 }
111}
112
113template<typename V>
114void StreamReader<V>::fillMatrices() {

Callers

nothing calls this directly

Calls 9

slot_sizeMethod · 0.80
key_sizeMethod · 0.80
pushBackMethod · 0.80
keyMethod · 0.80
val_sizeMethod · 0.80
valMethod · 0.80
addMethod · 0.45
idMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected