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

Function TestMeanAggregateNodes

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

Source from the content-addressed store, hash-verified

152}
153
154void TestMeanAggregateNodes(Client* client) {
155 AggregatingRequest req("movie", "MeanAggregator");
156 int64_t ids[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
157 int32_t segment_ids[10] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3};
158 int32_t num_segments = 4;
159 req.Set(ids, segment_ids, 10, 4);
160
161 AggregatingResponse res;
162 Status s = client->Aggregating(&req, &res);
163 std::cout << "MeanAggregateNodes: " << s.ToString() << std::endl;
164
165 int32_t size = res.NumSegments();
166
167 if (res.EmbeddingDim() > 0) {
168 int32_t float_num = res.EmbeddingDim();
169 const float* floats = res.Embeddings();
170 std::cout << "floats: ";
171 for (int32_t i = 0; i < size * float_num; ++i) {
172 std::cout << floats[i] << ' ';
173 }
174 std::cout << std::endl;
175 }
176}
177
178void TestMaxAggregateNodes(Client* client) {
179 AggregatingRequest req("movie", "MaxAggregator");

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