User-defined function related data structures¶
User-defined function related data structures.
There are two types of user-defined functions in DGL:
- Node UDF of signature
NodeBatch -> dict
. The argument represents a batch of nodes. The returned dictionary should havestr
type key andtensor
type values. - Edge UDF of signature
EdgeBatch -> dict
. The argument represents a batch of edges. The returned dictionary should havestr
type key andtensor
type values.
Note: the size of the batch dimension is determined by the DGL framework for good efficiency and small memory footprint. Users should not make assumption in the batch dimension.
EdgeBatch¶
The class that can represent a batch of edges.
EdgeBatch.src |
Return the feature data of the source nodes. |
EdgeBatch.dst |
Return the feature data of the destination nodes. |
EdgeBatch.data |
Return the edge feature data. |
EdgeBatch.edges () |
Return the edges contained in this batch. |
EdgeBatch.batch_size () |
Return the number of edges in this edge batch. |
EdgeBatch.__len__ () |
Return the number of edges in this edge batch. |
NodeBatch¶
The class that can represent a batch of nodes.
NodeBatch.data |
Return the node feature data. |
NodeBatch.mailbox |
Return the received messages. |
NodeBatch.nodes () |
Return the nodes contained in this batch. |
NodeBatch.batch_size () |
Return the number of nodes in this batch. |
NodeBatch.__len__ () |
Return the number of nodes in this node batch. |