MCPcopy Create free account
hub / github.com/pytorch/examples / forward

Method forward

gat/main.py:184–203  ·  view source on GitHub ↗

Performs a forward pass through the network. Args: input_tensor (torch.Tensor): Input tensor representing node features. adj_mat (torch.Tensor): Adjacency matrix representing graph structure. Returns: torch.Tensor: Output tensor after th

(self, input_tensor: torch.Tensor , adj_mat: torch.Tensor)

Source from the content-addressed store, hash-verified

182
183
184 def forward(self, input_tensor: torch.Tensor , adj_mat: torch.Tensor):
185 """
186 Performs a forward pass through the network.
187
188 Args:
189 input_tensor (torch.Tensor): Input tensor representing node features.
190 adj_mat (torch.Tensor): Adjacency matrix representing graph structure.
191
192 Returns:
193 torch.Tensor: Output tensor after the forward pass.
194 """
195
196 # Apply the first Graph Attention layer
197 x = self.gat1(input_tensor, adj_mat)
198 x = F.elu(x) # Apply ELU activation function to the output of the first layer
199
200 # Apply the second Graph Attention layer
201 x = self.gat2(x, adj_mat)
202
203 return F.log_softmax(x, dim=1) # Apply log softmax activation function
204
205################################
206### LOADING THE CORA DATASET ###

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected