Graph
rydberggpt.models.graph_embedding
¶
layers
¶
GraphLayer
¶
Bases: Module
Source code in src/rydberggpt/models/graph_embedding/layers.py
__init__(graph_layer: nn.Module, norm_layer: nn.Module, dropout: float)
¶
A GraphLayer is a single layer in a graph neural network, consisting of a graph layer, normalization layer, and dropout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph_layer |
Module
|
A graph layer, e.g., GCNConv, GATConv, etc. |
required |
norm_layer |
Module
|
A normalization layer, e.g., LayerNorm or BatchNorm. |
required |
dropout |
float
|
Dropout probability. |
required |
Source code in src/rydberggpt/models/graph_embedding/layers.py
forward(x: torch.Tensor, edge_index: Adj, edge_attr: OptTensor) -> torch.Tensor
¶
Forward pass through the GraphLayer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
Node feature matrix. |
required |
edge_index |
Adj
|
Edge indices. |
required |
edge_attr |
OptTensor
|
Edge feature matrix. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The output tensor after passing through the GraphLayer. |
Source code in src/rydberggpt/models/graph_embedding/layers.py
models
¶
GraphEmbedding
¶
Bases: Module
Source code in src/rydberggpt/models/graph_embedding/models.py
__init__(graph_layer: Type[Callable], in_node_dim: int, d_hidden: int, d_model: int, num_layers: int, dropout: float = 0.1) -> None
¶
GraphEmbedding class for creating a graph embedding with multiple layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph_layer |
Type[Callable]
|
The graph layer to be used in the embedding. |
required |
in_node_dim |
int
|
The input node dimension. (omega, delta, beta) |
required |
d_hidden |
int
|
The hidden dimension size. |
required |
d_model |
int
|
The output node dimension. |
required |
num_layers |
int
|
The number of layers in the graph embedding. |
required |
dropout |
float
|
The dropout rate. Defaults to 0.1. |
0.1
|
Source code in src/rydberggpt/models/graph_embedding/models.py
forward(data: Data) -> Tensor
¶
Forward pass through the graph embedding layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
The input graph data. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The output tensor with reshaped dimensions. |