mindspore_gl.graph.UnBatchHomoGraph

class mindspore_gl.graph.UnBatchHomoGraph[源代码]

从批处理的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)
>>> unbatch_fn = UnBatchHomoGraph()
>>> unbatch_graph = unbatch_fn(batch_graph)
>>> print(unbatch_graph[0].edge_count)
8