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

Function TestSumAggregateNodes

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

Source from the content-addressed store, hash-verified

128}
129
130void TestSumAggregateNodes(Client* client) {
131 AggregatingRequest req("movie", "SumAggregator");
132 int64_t ids[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
133 int32_t segment_ids[10] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3};
134 int32_t num_segments = 4;
135 req.Set(ids, segment_ids, 10, 4);
136
137 AggregatingResponse res;
138 Status s = client->Aggregating(&req, &res);
139 std::cout << "SumAggregateNodes: " << s.ToString() << std::endl;
140
141 int32_t size = res.NumSegments();
142
143 if (res.EmbeddingDim() > 0) {
144 int32_t float_num = res.EmbeddingDim();
145 const float* floats = res.Embeddings();
146 std::cout << "floats: ";
147 for (int32_t i = 0; i < size * float_num; ++i) {
148 std::cout << floats[i] << ' ';
149 }
150 std::cout << std::endl;
151 }
152}
153
154void TestMeanAggregateNodes(Client* client) {
155 AggregatingRequest req("movie", "MeanAggregator");

Callers 1

mainFunction · 0.70

Calls 5

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

Tested by

no test coverage detected