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

Method fillMatrices

src/data/stream_reader.h:114–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113template<typename V>
114void StreamReader<V>::fillMatrices() {
115 if (!matrices_) return;
116
117 auto info = info_parser_.info();
118 info_parser_.clear();
119 for (int i = 0; i < vslots_.size(); ++i) {
120 if (vslots_[i].empty()) continue;
121 MatrixInfo mat_info = readMatrixInfo(info, i, sizeof(uint64), sizeof(V));
122 if (mat_info.type() == MatrixInfo::DENSE) {
123 matrices_->push_back(MatrixPtr<V>(new DenseMatrix<V>(mat_info, vslots_[i].val)));
124 } else {
125 auto& rs = vslots_[i].row_siz;
126 size_t n = rs.size();
127 SArray<size_t> offset(n + 1); offset[0] = 0;
128 for (size_t j = 0; j < n; ++j) offset[j+1] = offset[j] + rs[j];
129 matrices_->push_back(MatrixPtr<V>(new SparseMatrix<uint64, V>(
130 mat_info, offset, vslots_[i].col_idx, vslots_[i].val)));
131 CHECK_EQ(vslots_[i].col_idx.size(), offset.back());
132 if (!vslots_[i].val.empty()) {
133 CHECK_EQ(vslots_[i].val.size(), offset.back());
134 }
135 }
136 }
137}
138
139template<typename V>
140bool StreamReader<V>::readMatricesFromProto() { //uint32 num_ex, MatrixPtrList<V>* mat) {

Callers

nothing calls this directly

Calls 7

readMatrixInfoFunction · 0.85
backMethod · 0.80
infoMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected