Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore_gl.BatchedGraphField

class mindspore_gl.BatchedGraphField(src_idx=None, dst_idx=None, n_nodes=None, n_edges=None, ver_subgraph_idx=None, edge_subgraph_idx=None, graph_mask=None, indices=None, indptr=None, indices_backward=None, indptr_backward=None, csr=False)[source]

The data container for a batched graph.

The edge information are stored in COO format.

Parameters
  • src_idx (Tensor, optional) – A tensor with shape (N_EDGES), with int dtype, represents the source node index of COO edge matrix.

  • dst_idx (Tensor, optional) – A tensor with shape (N_EDGES), with int dtype, represents the destination node index of COO edge matrix.

  • n_nodes (int, optional) – An integer, represent the nodes count of the graph.

  • n_edges (int, optional) – An integer, represent the edges count of the graph.

  • ver_subgraph_idx (Tensor, optional) – A tensor with shape (N_NODES), with int dtype, indicates each node belonging to which subgraph.

  • edge_subgraph_idx (Tensor, optional) – A tensor with shape (N_EDGES,), with int dtype, indicates each edge belonging to which subgraph.

  • graph_mask (Tensor, optional) – A tensor with shape (N_GRAPHS,), with int dtype, indicates whether the subgraph is exist.

  • indices (Tensor, optional) – A tensor with shape (N_EDGES), with int dtype, represents the indices of CSR edge matrix. Default: None.

  • indptr (Tensor, optional) – A tensor with shape (N_NODES), with int dtype, represents the indptr of CSR edge matrix. Default: None.

  • indices_backward (Tensor, optional) – A tensor with shape (N_EDGES), with int dtype, represents the indices backward of CSR edge matrix. Default: None.

  • indptr_backward (Tensor, optional) – A tensor with shape (N_NODES), with int dtype, represents the indptr backward of CSR edge matrix. Default: None.

  • csr (bool, optional) – Is the graph is CSR type. Default: False.

Supported Platforms:

Ascend GPU

Examples

>>> import mindspore as ms
>>> from mindspore_gl import BatchedGraphField
>>> n_nodes = 9
>>> n_edges = 11
>>> src_idx = ms.Tensor([0, 2, 2, 3, 4, 5, 5, 6, 8, 8, 8], ms.int32)
>>> dst_idx = ms.Tensor([1, 0, 1, 5, 3, 4, 6, 4, 8, 8, 8], ms.int32)
>>> ver_subgraph_idx = ms.Tensor([0, 0, 0, 1, 1, 1, 1, 2, 2], ms.int32)
>>> edge_subgraph_idx = ms.Tensor([0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2], ms.int32)
>>> graph_mask = ms.Tensor([1, 1, 0], ms.int32)
>>> batched_graph_field = BatchedGraphField(src_idx, dst_idx, n_nodes, n_edges,
...                                         ver_subgraph_idx, edge_subgraph_idx, graph_mask)
>>> print(batched_graph_field.get_batched_graph())
[Tensor(shape=[11], dtype=Int32, value= [0, 2, 2, 3, 4, 5, 5, 6, 8, 8, 8]),
Tensor(shape=[11], dtype=Int32, value= [1, 0, 1, 5, 3, 4, 6, 4, 8, 8, 8]), 9, 11,
Tensor(shape=[9], dtype=Int32, value= [0, 0, 0, 1, 1, 1, 1, 2, 2]),
Tensor(shape=[11], dtype=Int32, value= [0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2]),
Tensor(shape=[3], dtype=Int32, value= [1, 1, 0])]
get_batched_graph()[source]

Get the batched Graph.

Returns

List, a list of tensor, which should be used for construct function.