mindspore_gl.graph.BatchHomoGraph

class mindspore_gl.graph.BatchHomoGraph[源代码]

BatchHomoGraph,将一个MindHomoGraph列表和batch_meta信息的打包放进一个MindHomoGraph中。

输入:
  • graph_list (List[MindHomoGraph]) - MindHomoGraph的列表。

支持平台:

Ascend GPU

样例:

>>> from mindspore_gl.graph.ops import BatchHomoGraph
>>> import numpy as np
>>> from mindspore_gl.graph import MindHomoGraph
>>> graph_list = []
>>> for _ in range(5):
...     graph = MindHomoGraph()
...     edges = np.array([[0, 2, 2, 3, 4, 5, 5, 6], [1, 0, 1, 5, 3, 4, 6, 4]])
...     graph.set_topo_coo(edges)
...     graph.node_count = 7
...     graph.edge_count = 8
...     graph_list.append(graph)
>>> batch_fn = BatchHomoGraph()
>>> batch_graph = batch_fn(graph_list)
>>> print(batch_graph.edge_count)
40