Get aggregated embedding of fixed size of neighbors of batch seed nodes. The shape of neighbors embeddings is `[batch_size, num_neighbors, float_attr_num]`, after aggregation on axis=1, the shape is `[batch_size, float_attr_num]`. Args: func ("sum" | "mean" | "min" | "max
(self, func="sum")
| 340 | return agged |
| 341 | |
| 342 | def embedding_agg(self, func="sum"): |
| 343 | """ |
| 344 | Get aggregated embedding of fixed size of neighbors of batch seed nodes. |
| 345 | The shape of neighbors embeddings is |
| 346 | `[batch_size, num_neighbors, float_attr_num]`, after aggregation on axis=1, |
| 347 | the shape is `[batch_size, float_attr_num]`. |
| 348 | |
| 349 | Args: |
| 350 | func ("sum" | "mean" | "min" | "max" | "prod"): |
| 351 | the built-in aggregate functions. |
| 352 | """ |
| 353 | if not len(self.shape) == 2: |
| 354 | raise ValueError("embedding_agg is for Nodes with 2 dimension," |
| 355 | "and the default aggregated dimension is axis=1") |
| 356 | segment_ids = \ |
| 357 | [i for i in range(self.shape[0]) for _ in range(self.shape[1])] |
| 358 | agged = self._agg(func, segment_ids, self.shape[0]) |
| 359 | return np.reshape(agged, |
| 360 | (self.shape[0], self._get_decoder().float_attr_num)) |
| 361 | |
| 362 | class SparseNodes(Nodes, SparseBase): |
| 363 | """ SparseNodes is the returned value of full neighbor sampler which |
nothing calls this directly
no test coverage detected