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

Method embedding_agg

graphlearn/python/data/values.py:430–445  ·  view source on GitHub ↗

Get aggregated embeddings of full neighbors of batch seed nodes. The shape of neighbors embeddings is `[total_num_nbrs, float_attr_num]`. After aggregation, the shape is `[redcued_num_nbrs, float_attr_num]`. Args: func ("sum" | "mean" | "min" | "max" | "prod"): the bu

(self, func="sum")

Source from the content-addressed store, hash-verified

428 raise StopIteration
429
430 def embedding_agg(self, func="sum"):
431 """
432 Get aggregated embeddings of full neighbors of batch seed nodes.
433 The shape of neighbors embeddings is `[total_num_nbrs, float_attr_num]`.
434 After aggregation, the shape is `[redcued_num_nbrs, float_attr_num]`.
435
436 Args:
437 func ("sum" | "mean" | "min" | "max" | "prod"):
438 the built-in aggregate functions.
439 """
440 float_attr_num = self._get_decoder().float_attr_num
441 batch_size = len(self.offsets)
442 segment_ids = \
443 [i for i in range(batch_size) for _ in range(self.offsets[i])]
444 agged = self._agg(func, segment_ids, batch_size)
445 return np.reshape(agged, (batch_size, float_attr_num))
446
447
448class Edges(Values):

Callers

nothing calls this directly

Calls 3

_aggMethod · 0.80
reshapeMethod · 0.80
_get_decoderMethod · 0.45

Tested by

no test coverage detected