MCPcopy Create free account
hub / github.com/alibaba/graph-learn / TestProdAggregateNodes

Function TestProdAggregateNodes

graphlearn/src/service/test/client_test.cpp:226–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226void TestProdAggregateNodes(Client* client) {
227 AggregatingRequest req("movie", "ProdAggregator");
228 int64_t ids[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
229 int32_t segment_ids[10] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3};
230 int32_t num_segments = 4;
231 req.Set(ids, segment_ids, 10, 4);
232
233 AggregatingResponse res;
234 Status s = client->Aggregating(&req, &res);
235 std::cout << "ProdAggregateNodes: " << s.ToString() << std::endl;
236
237 int32_t size = res.NumSegments();
238
239 if (res.EmbeddingDim() > 0) {
240 int32_t float_num = res.EmbeddingDim();
241 const float* floats = res.Embeddings();
242 std::cout << "floats: ";
243 for (int32_t i = 0; i < size * float_num; ++i) {
244 std::cout << floats[i] << ' ';
245 }
246 std::cout << std::endl;
247 }
248}
249
250void TestRandomSampleNeighbors(Client* client) {
251 SamplingRequest req("click", "RandomSampler", 3);

Callers 1

mainFunction · 0.85

Calls 5

EmbeddingDimMethod · 0.80
EmbeddingsMethod · 0.80
SetMethod · 0.45
ToStringMethod · 0.45
NumSegmentsMethod · 0.45

Tested by

no test coverage detected