MCPcopy Create free account
hub / github.com/Tencent/embedx / ParseAndCheckNodeFrom

Function ParseAndCheckNodeFrom

src/model/instance_reader_util.cc:110–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void ParseAndCheckNodeFrom(deepx_core::Instance* inst, const std::string& name,
111 uint16_t user_group, uint16_t item_group,
112 vec_int_t* user_nodes, vec_int_t* item_nodes) {
113 auto* x_ptr = &inst->get_or_insert<csr_t>(name);
114 user_nodes->clear();
115 item_nodes->clear();
116
117 CSR_FOR_EACH_ROW(*x_ptr, i) {
118 CSR_FOR_EACH_COL(*x_ptr, i) {
119 auto feat_id = CSR_COL(*x_ptr);
120 auto group = io_util::GetNodeType(feat_id);
121 if (group == user_group) {
122 user_nodes->emplace_back(feat_id);
123 }
124 if (group == item_group) {
125 item_nodes->emplace_back(feat_id);
126 }
127 }
128 if ((int)user_nodes->size() != (i + 1)) {
129 DXTHROW_INVALID_ARGUMENT(
130 "Invalid user_nodes, the size of user_node: %zu must be %d.",
131 user_nodes->size(), i + 1);
132 }
133 if ((int)item_nodes->size() != (i + 1)) {
134 DXTHROW_INVALID_ARGUMENT(
135 "Invalid item_nodes, the size of item_nodes: %zu must be %d.",
136 item_nodes->size(), i + 1);
137 }
138 }
139}
140
141void GenerateSeqFrom(const GraphClient* client, const vec_int_t& user_nodes,
142 const vec_int_t& item_nodes,

Callers 3

GetTrainBatchMethod · 0.85
GetPredictBatchMethod · 0.85
GetTrainBatchMethod · 0.85

Calls 4

GetNodeTypeFunction · 0.85
CSR_FOR_EACH_ROWFunction · 0.50
CSR_FOR_EACH_COLFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected