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.

PR

Just a small problem.

I can fix it online!

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.

mindearth.cell.GraphCastNet

View Source On Gitee
class mindearth.cell.GraphCastNet(vg_in_channels, vg_out_channels, vm_in_channels, em_in_channels, eg2m_in_channels, em2g_in_channels, latent_dims, processing_steps, g2m_src_idx, g2m_dst_idx, m2m_src_idx, m2m_dst_idx, m2g_src_idx, m2g_dst_idx, mesh_node_feats, mesh_edge_feats, g2m_edge_feats, m2g_edge_feats, per_variable_level_mean, per_variable_level_std, recompute=False)[source]

The GraphCast is based on graph neural networks and a novel high-resolution multi-scale mesh representation autoregressive model. The details can be found in GraphCast: Learning skillful medium-range global weather forecasting.

Parameters
  • vg_in_channels (int) – The grid node dimensions.

  • vg_out_channels (int) – The grid node final dimensions.

  • vm_in_channels (int) – The mesh node dimensions.

  • em_in_channels (int) – The mesh edge dimensions.

  • eg2m_in_channels (int) – The grid to mesh edge dimensions.

  • em2g_in_channels (int) – The mesh to grid edge dimensions.

  • latent_dims (int) – The number of dims of hidden layers.

  • processing_steps (int) – The number of processing steps.

  • g2m_src_idx (Tensor) – The source node index of grid to mesh edges.

  • g2m_dst_idx (Tensor) – The destination node index of grid to mesh edges.

  • m2m_src_idx (Tensor) – The source node index of mesh to mesh edges.

  • m2m_dst_idx (Tensor) – The destination node index of mesh to mesh edges.

  • m2g_src_idx (Tensor) – The source node index of mesh to grid edges.

  • m2g_dst_idx (Tensor) – The destination node index of mesh to grid edges.

  • mesh_node_feats (Tensor) – The features of mesh nodes.

  • mesh_edge_feats (Tensor) – The features of mesh edges.

  • g2m_edge_feats (Tensor) – The features of grid to mesh edges.

  • m2g_edge_feats (Tensor) – The features of mesh to grid edges.

  • per_variable_level_mean (Tensor) – The mean of the per-variable-level inverse variance of time differences.

  • per_variable_level_std (Tensor) – The standard deviation of the per-variable-level inverse variance of time differences.

  • recompute (bool, optional) – Determine whether to recompute. Default: False .

Inputs:
  • input (Tensor) - Tensor of shape (batch_size,height_sizewidth_size,feature_size) .

Outputs:
  • output (Tensor) - Tensor of shape (height_sizewidth_size,feature_size) .

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> import mindspore as ms
>>> from mindspore import context, Tensor
>>> from mindearth.cell.graphcast.graphcastnet import GraphCastNet
>>>
>>> mesh_node_num = 2562
>>> grid_node_num = 32768
>>> mesh_edge_num = 20460
>>> g2m_edge_num = 50184
>>> m2g_edge_num = 98304
>>> vm_in_channels = 3
>>> em_in_channels = 4
>>> eg2m_in_channels = 4
>>> em2g_in_channels = 4
>>> feature_num = 69
>>> g2m_src_idx = Tensor(np.random.randint(0, grid_node_num, size=[g2m_edge_num]), ms.int32)
>>> g2m_dst_idx = Tensor(np.random.randint(0, mesh_node_num, size=[g2m_edge_num]), ms.int32)
>>> m2m_src_idx = Tensor(np.random.randint(0, mesh_node_num, size=[mesh_edge_num]), ms.int32)
>>> m2m_dst_idx = Tensor(np.random.randint(0, mesh_node_num, size=[mesh_edge_num]), ms.int32)
>>> m2g_src_idx = Tensor(np.random.randint(0, mesh_node_num, size=[m2g_edge_num]), ms.int32)
>>> m2g_dst_idx = Tensor(np.random.randint(0, grid_node_num, size=[m2g_edge_num]), ms.int32)
>>> mesh_node_feats = Tensor(np.random.rand(mesh_node_num, vm_in_channels).astype(np.float32), ms.float32)
>>> mesh_edge_feats = Tensor(np.random.rand(mesh_edge_num, em_in_channels).astype(np.float32), ms.float32)
>>> g2m_edge_feats = Tensor(np.random.rand(g2m_edge_num, eg2m_in_channels).astype(np.float32), ms.float32)
>>> m2g_edge_feats = Tensor(np.random.rand(m2g_edge_num, em2g_in_channels).astype(np.float32), ms.float32)
>>> per_variable_level_mean = Tensor(np.random.rand(feature_num,).astype(np.float32), ms.float32)
>>> per_variable_level_std = Tensor(np.random.rand(feature_num,).astype(np.float32), ms.float32)
>>> grid_node_feats = Tensor(np.random.rand(grid_node_num, feature_num).astype(np.float32), ms.float32)
>>> graphcast_model = GraphCastNet(vg_in_channels=feature_num,
>>>                                vg_out_channels=feature_num,
>>>                                vm_in_channels=vm_in_channels,
>>>                                em_in_channels=em_in_channels,
>>>                                eg2m_in_channels=eg2m_in_channels,
>>>                                em2g_in_channels=em2g_in_channels,
>>>                                latent_dims=512,
>>>                                processing_steps=4,
>>>                                g2m_src_idx=g2m_src_idx,
>>>                                g2m_dst_idx=g2m_dst_idx,
>>>                                m2m_src_idx=m2m_src_idx,
>>>                                m2m_dst_idx=m2m_dst_idx,
>>>                                m2g_src_idx=m2g_src_idx,
>>>                                m2g_dst_idx=m2g_dst_idx,
>>>                                mesh_node_feats=mesh_node_feats,
>>>                                mesh_edge_feats=mesh_edge_feats,
>>>                                g2m_edge_feats=g2m_edge_feats,
>>>                                m2g_edge_feats=m2g_edge_feats,
>>>                                per_variable_level_mean=per_variable_level_mean,
>>>                                per_variable_level_std=per_variable_level_std)
>>> out = graphcast_model(Tensor(grid_node_feats, ms.float32))
>>> print(out.shape)
(32768, 69))