![]() ![]() permute ( 2, 0, 1, 3 ) else : X_tilde = for t in range ( num_of_timesteps ): lambda_max = LaplacianLambdaMax ()( Data ( edge_index = edge_index, edge_attr = None, num_nodes = num_of_vertices, ) ). nb_time_filter, batch_size, num_of_timesteps ) X_tilde = X_tilde. _cheb_conv ( x = X_tilde, edge_index = edge_index, lambda_max = lambda_max ) ) X_tilde = X_tilde. reshape ( num_of_vertices, in_channels, num_of_timesteps * batch_size ) X_tilde = X_tilde. permute ( 2, 0, 1, 3 ) X_tilde = X_tilde. shape if not isinstance ( edge_index, list ): lambda_max = LaplacianLambdaMax ()( Data ( edge_index = edge_index, edge_attr = None, num_nodes = num_of_vertices ) ). """ batch_size, num_of_vertices, in_channels, num_of_timesteps = X. Return types: * X (PyTorch FloatTensor) - Hidden state tensor for all nodes, with shape (B, N_nodes, nb_time_filter, T_out). * edge_index (PyTorch LongTensor): Edge indices, can be an array of a list of Tensor arrays, depending on whether edges change over time. Arg types: * X (PyTorch FloatTensor) - Node features for T time periods, with shape (B, N_nodes, F_in, T_in). ![]() FloatTensor : """ Making a forward pass with a single MSTGCN block. uniform_ ( p ) def forward ( self, X : torch. _reset_parameters () def _reset_parameters ( self ): for p in self. Conv2d ( in_channels, nb_time_filter, kernel_size = ( 1, 1 ), stride = ( 1, time_strides ) ) self. Conv2d ( nb_chev_filter, nb_time_filter, kernel_size = ( 1, 3 ), stride = ( 1, time_strides ), padding = ( 0, 1 ), ) self. _cheb_conv = ChebConv ( in_channels, nb_chev_filter, K, normalization = None ) self. """ def _init_ ( self, in_channels : int, K : int, nb_chev_filter : int, nb_time_filter : int, time_strides : int, ): super ( MSTGCNBlock, self ). time_strides (int): Time strides during temporal convolution. nb_time_filters (int): Number of time filters. nb_chev_filters (int): Number of Chebyshev filters. Module ): r """An implementation of the Multi-Component Spatial-Temporal Graph Convolution block from this paper: `"Attention Based Spatial-Temporal Graph Convolutional Networks for Traffic Flow Forecasting." `_ Args: in_channels (int): Number of input features. Import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.data import Data from torch_geometric.nn import ChebConv from torch_ansforms import LaplacianLambdaMax class MSTGCNBlock ( nn. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |