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

Function readMatrixInfo

src/data/common.cc:19–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19MatrixInfo readMatrixInfo(
20 const ExampleInfo& info, int slot_id, int sizeof_idx, int sizeof_val) {
21 MatrixInfo f;
22 int i = 0;
23 for (; i < info.slot_size(); ++i) if (info.slot(i).id() == slot_id) break;
24 if (i == info.slot_size()) return f;
25
26 auto slot = info.slot(i);
27 if (slot.format() == SlotInfo::DENSE) {
28 f.set_type(MatrixInfo::DENSE);
29 } else if (slot.format() == SlotInfo::SPARSE) {
30 f.set_type(MatrixInfo::SPARSE);
31 } else if (slot.format() == SlotInfo::SPARSE_BINARY) {
32 f.set_type(MatrixInfo::SPARSE_BINARY);
33 }
34 f.set_row_major(true);
35 f.set_id(slot.id());
36 f.mutable_row()->set_begin(0);
37 f.mutable_row()->set_end(info.num_ex());
38 f.mutable_col()->set_begin(slot.min_key());
39 f.mutable_col()->set_end(slot.max_key());
40
41 f.set_nnz(slot.nnz_ele());
42 f.set_sizeof_index(sizeof_idx);
43 f.set_sizeof_value(sizeof_val);
44
45 // LL << info.DebugString() << "\n" << f.DebugString();
46 // *f.mutable_ins_info() = info;
47 return f;
48}
49
50ExampleInfo mergeExampleInfo(const ExampleInfo& A, const ExampleInfo& B) {
51 std::map<int, SlotInfo> slots;

Callers 2

fillMatricesMethod · 0.85
infoMethod · 0.85

Calls 15

slot_sizeMethod · 0.80
set_row_majorMethod · 0.80
set_beginMethod · 0.80
mutable_rowMethod · 0.80
set_endMethod · 0.80
num_exMethod · 0.80
mutable_colMethod · 0.80
min_keyMethod · 0.80
max_keyMethod · 0.80
nnz_eleMethod · 0.80
set_sizeof_indexMethod · 0.80
set_sizeof_valueMethod · 0.80

Tested by

no test coverage detected