From 9c08cd6bf055eea253cd91d1e3765576004fd9a7 Mon Sep 17 00:00:00 2001 From: Mufei Li Date: Wed, 18 Nov 2020 15:40:25 +0800 Subject: [PATCH] Update (#2354) --- docs/source/guide/graph-feature.rst | 4 ++-- docs/source/guide_cn/graph-feature.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/guide/graph-feature.rst b/docs/source/guide/graph-feature.rst index ac207391e0..5311092643 100644 --- a/docs/source/guide/graph-feature.rst +++ b/docs/source/guide/graph-feature.rst @@ -8,7 +8,7 @@ The nodes and edges of a :class:`~dgl.DGLGraph` can have several user-defined named features for storing graph-specific properties of the nodes and edges. These features can be accessed via the :py:attr:`~dgl.DGLGraph.ndata` and :py:attr:`~dgl.DGLGraph.edata` interface. For example, the following code creates two node -features (named ``'x'`` and ``'y'`` in line 5 and 8) and one edge feature (named ``'x'`` in line 6). +features (named ``'x'`` and ``'y'`` in line 8 and 15) and one edge feature (named ``'x'`` in line 9). .. code-block:: python :linenos: @@ -45,7 +45,7 @@ Important facts about the :py:attr:`~dgl.DGLGraph.ndata`/:py:attr:`~dgl.DGLGraph nodes/edges in the graph. - Features of the same name must have the same dimensionality and data type. - The feature tensor is in row-major layout -- each row-slice stores the feature of one - node or edge (e.g., see lines 10-11 in the above example). + node or edge (e.g., see lines 16 and 18 in the above example). For weighted graphs, one can store the weights as an edge feature as below. diff --git a/docs/source/guide_cn/graph-feature.rst b/docs/source/guide_cn/graph-feature.rst index fc4feb2b2f..feefa852ba 100644 --- a/docs/source/guide_cn/graph-feature.rst +++ b/docs/source/guide_cn/graph-feature.rst @@ -7,7 +7,7 @@ :class:`~dgl.DGLGraph` 对象的节点和边可具有多个用户定义的、可命名的特征,以储存图的节点和边的属性。 通过 :py:attr:`~dgl.DGLGraph.ndata` 和 :py:attr:`~dgl.DGLGraph.edata` 接口可访问这些特征。 -例如,以下代码创建了2个节点特征(分别在第5、8行命名为 ``'x'`` 、 ``'y'`` )和1个边特征(在第6行命名为 ``'x'`` )。 +例如,以下代码创建了2个节点特征(分别在第8、15行命名为 ``'x'`` 、 ``'y'`` )和1个边特征(在第9行命名为 ``'x'`` )。 .. code-block:: python :linenos: @@ -39,7 +39,7 @@ - 通过张量分配创建特征时,DGL会将特征赋给图中的每个节点和每条边。该张量的第一维必须与图中节点或边的数量一致。 不能将特征赋给图中节点或边的子集。 - 相同名称的特征必须具有相同的维度和数据类型。 -- 特征张量使用"行优先"的原则,即每个行切片储存1个节点或1条边的特征(参考上述示例代码的第10~11行)。 +- 特征张量使用"行优先"的原则,即每个行切片储存1个节点或1条边的特征(参考上述示例代码的第16和18行)。 对于加权图,用户可以将权重储存为一个边特征,如下。