@@ -540,6 +540,27 @@ def _exchange_ghosts_graph(
540540 pt_expt subclass overrides this to overwrite halo rows via
541541 ``deepmd_export::border_op`` when ``comm_dict`` is provided (C++
542542 multi-rank extended-region graphs).
543+
544+ Parameters
545+ ----------
546+ g1
547+ Flat node-wise atomic invariant rep, with shape [n_total, ng1].
548+ comm_dict
549+ MPI communication metadata; must be ``None`` on this (dpmodel)
550+ path.
551+ n_total
552+ Total number of nodes (unused here; the pt_expt override needs
553+ it).
554+
555+ Returns
556+ -------
557+ g1 : Array
558+ The (unchanged) node channel, with shape [n_total, ng1].
559+
560+ Raises
561+ ------
562+ NotImplementedError
563+ If ``comm_dict`` is not ``None``.
543564 """
544565 del n_total
545566 if comm_dict is not None :
@@ -1124,8 +1145,34 @@ def _cal_hg_graph(
11241145) -> Array :
11251146 """Graph twin of :func:`_cal_hg`: hg[n, a, b] = sum_{e: dst(e)=n} h_e[a] g_e[b].
11261147
1127- ``nnei`` is the block sel (the smooth-branch normalization constant, spec
1128- decision #9: sel = normalization only).
1148+ Parameters
1149+ ----------
1150+ g
1151+ Flat edge-wise invariant rep, with shape [n_edge, ng].
1152+ h
1153+ Flat edge-wise equivariant rep, with shape [n_edge, 3].
1154+ edge_mask
1155+ Edge mask, where zero means no edge, with shape [n_edge].
1156+ sw
1157+ The switch function per edge, with shape [n_edge].
1158+ dst
1159+ Destination (center) node index of each edge, with shape [n_edge].
1160+ n_total
1161+ Total number of nodes.
1162+ nnei
1163+ The block sel (the smooth-branch normalization constant, spec
1164+ decision #9: sel = normalization only).
1165+ smooth
1166+ Whether to use the smooth (sw-weighted, sel-normalized) branch.
1167+ epsilon
1168+ Degree-normalization protection for the non-smooth branch.
1169+ use_sqrt_nnei
1170+ Whether to normalize by sqrt(nnei) instead of nnei.
1171+
1172+ Returns
1173+ -------
1174+ hg : Array
1175+ Transposed rotation matrix per node, with shape [n_total, 3, ng].
11291176 """
11301177 from deepmd .dpmodel .utils .neighbor_graph import (
11311178 segment_sum ,
@@ -1148,7 +1195,20 @@ def _cal_hg_graph(
11481195
11491196
11501197def _cal_grrg_graph (hg : Array , axis_neuron : int ) -> Array :
1151- """Graph twin of :func:`_cal_grrg` (node-local, no neighbor axis)."""
1198+ """Graph twin of :func:`_cal_grrg` (node-local, no neighbor axis).
1199+
1200+ Parameters
1201+ ----------
1202+ hg
1203+ Transposed rotation matrix per node, with shape [n_total, 3, ng].
1204+ axis_neuron
1205+ Size of the submatrix of hg (embedding matrix).
1206+
1207+ Returns
1208+ -------
1209+ grrg : Array
1210+ Atomic invariant rep, with shape [n_total, axis_neuron * ng].
1211+ """
11521212 xp = array_api_compat .array_namespace (hg )
11531213 n , _ , ng = hg .shape
11541214 hgm = hg [..., :axis_neuron ] # (N, 3, axis)
@@ -1169,7 +1229,38 @@ def symmetrization_op_graph(
11691229 epsilon : float = 1e-4 ,
11701230 use_sqrt_nnei : bool = True ,
11711231) -> Array :
1172- """Graph twin of :func:`symmetrization_op`."""
1232+ """Graph twin of :func:`symmetrization_op`.
1233+
1234+ Parameters
1235+ ----------
1236+ g
1237+ Flat edge-wise invariant rep, with shape [n_edge, ng].
1238+ h
1239+ Flat edge-wise equivariant rep, with shape [n_edge, 3].
1240+ edge_mask
1241+ Edge mask, where zero means no edge, with shape [n_edge].
1242+ sw
1243+ The switch function per edge, with shape [n_edge].
1244+ dst
1245+ Destination (center) node index of each edge, with shape [n_edge].
1246+ n_total
1247+ Total number of nodes.
1248+ nnei
1249+ The block sel (the smooth-branch normalization constant).
1250+ axis_neuron
1251+ Size of the submatrix of hg (embedding matrix).
1252+ smooth
1253+ Whether to use the smooth (sw-weighted, sel-normalized) branch.
1254+ epsilon
1255+ Degree-normalization protection for the non-smooth branch.
1256+ use_sqrt_nnei
1257+ Whether to normalize by sqrt(nnei) instead of nnei.
1258+
1259+ Returns
1260+ -------
1261+ grrg : Array
1262+ Atomic invariant rep, with shape [n_total, axis_neuron * ng].
1263+ """
11731264 hg = _cal_hg_graph (
11741265 g ,
11751266 h ,
@@ -1480,7 +1571,26 @@ def call(
14801571 def call_graph (
14811572 self , AA : Array , g2 : Array , q_e : Array , k_e : Array , e_tot : int
14821573 ) -> Array :
1483- """Graph twin of :meth:`call`: out[q] = sum_k AA[q,k] g2v[k] per head."""
1574+ """Graph twin of :meth:`call`: out[q] = sum_k AA[q,k] g2v[k] per head.
1575+
1576+ Parameters
1577+ ----------
1578+ AA
1579+ Attention map on the flat pair axis, with shape [n_pair, nh].
1580+ g2
1581+ Flat edge-wise pair invariant rep, with shape [n_edge, ng2].
1582+ q_e
1583+ Query edge index of each pair, with shape [n_pair].
1584+ k_e
1585+ Key edge index of each pair, with shape [n_pair].
1586+ e_tot
1587+ Total number of edges.
1588+
1589+ Returns
1590+ -------
1591+ g2_new : Array
1592+ Attention-updated edge channel, with shape [n_edge, ng2].
1593+ """
14841594 from deepmd .dpmodel .utils .neighbor_graph import (
14851595 segment_sum ,
14861596 )
@@ -1578,7 +1688,27 @@ def call(
15781688 def call_graph (
15791689 self , AA : Array , h2 : Array , q_e : Array , k_e : Array , e_tot : int
15801690 ) -> Array :
1581- """Graph twin of :meth:`call` (heads applied to the equivariant channel)."""
1691+ """Graph twin of :meth:`call` (heads applied to the equivariant channel).
1692+
1693+ Parameters
1694+ ----------
1695+ AA
1696+ Attention map on the flat pair axis, with shape [n_pair, nh].
1697+ h2
1698+ Flat edge-wise pair equivariant rep, with shape [n_edge, 3].
1699+ q_e
1700+ Query edge index of each pair, with shape [n_pair].
1701+ k_e
1702+ Key edge index of each pair, with shape [n_pair].
1703+ e_tot
1704+ Total number of edges.
1705+
1706+ Returns
1707+ -------
1708+ h2_new : Array
1709+ Attention-updated equivariant edge channel, with shape
1710+ [n_edge, 3].
1711+ """
15821712 from deepmd .dpmodel .utils .neighbor_graph import (
15831713 segment_sum ,
15841714 )
@@ -2260,6 +2390,11 @@ def _update_g1_conv_graph(
22602390 The block sel: the smooth-branch normalization constant AND the
22612391 fixed dense softmax width for the attention phantom-count
22622392 compensation (see :meth:`Atten2Map.call_graph`).
2393+
2394+ Returns
2395+ -------
2396+ g1_conv : Array
2397+ Convolution-updated node channel, with shape [n_total, ng1].
22632398 """
22642399 from deepmd .dpmodel .utils .neighbor_graph import (
22652400 segment_sum ,
@@ -2339,6 +2474,11 @@ def _update_g2_g1g1_graph(
23392474 Edge mask, where zero means no edge, with shape [n_edge].
23402475 sw
23412476 The switch function, with shape [n_edge].
2477+
2478+ Returns
2479+ -------
2480+ g1g1 : Array
2481+ Per-edge center-neighbor g1 product, with shape [n_edge, ng1].
23422482 """
23432483 xp = array_api_compat .array_namespace (g1 , edge_mask , sw )
23442484 # (n_edge, ng1)
0 commit comments