dgl.nn.pytorch中edge_softmax的参数
时间: 2024-05-13 17:15:17 浏览: 13
在dgl.nn.pytorch中,edge_softmax函数的参数是边权重张量和图对象。具体来说,函数的定义如下:
```python
def edge_softmax(graph, efeat):
r"""Apply softmax over the edges of a graph.
Description
-----------
Given a graph and its edge features, this function computes the softmax
over the edge features for each destination node. Suppose we have a
graph with :math:`N` nodes, :math:`E` edges and feature size :math:`D`.
If the input edge feature tensor is :math:`(E, D)`, the output tensor
will be of shape :math:`(E, 1)`.
Parameters
----------
graph : DGLGraph
The graph to perform edge softmax.
efeat : torch.Tensor
The input edge feature tensor.
Returns
-------
tensor
Softmax probability tensor with respect to the last dimension of efeat.
Notes
-----
* Input shape: :math:`(E, D)`
* Output shape: :math:`(E, 1)`
"""
```
其中`graph`是DGLGraph对象,表示当前的图,`efeat`是维度为`(E, D)`的张量,其中`E`表示边的数量,`D`表示每条边的特征维度。函数返回的是一个维度为`(E, 1)`的张量,表示每条边的softmax概率。