(self, x)
return torch.stack(res)
Perform forward pass.

        Parameters
        ----------
        x : torch.Tensor
            Tensor of shape `(n_samples, n_channels, lookback, n_assets)`.

        Returns
        -------
        torch.Tensor
            Tensor of shape `(n_samples, self.hidden_size, lookback, n_assets)`.
Perform forward pass.
Perform forward pass .
def forward(self, x):
        """Perform forward pass.

        Parameters
        ----------
        x : torch.Tensor
            Tensor of shape `(n_samples, n_channels, lookback, n_assets)`.

        Returns
        -------
        torch.Tensor
            Tensor of shape `(n_samples, self.hidden_size, lookback, n_assets)`.

        """
        n_samples, n_channels, lookback, n_assets = x.shape
        x_swapped = x.permute(0, 2, 3, 1)  # n_samples, lookback, n_assets, n_channels
        res = []

        for i in range(n_samples):
            all_hidden_ = self.cell(x_swapped[i])[0]  # lookback, n_assets, hidden_size
            res.append(all_hidden_.permute(2, 0, 1))  # hidden_size, lookback, n_assets

        return torch.stack(res)
def forward ( self , x ) : n_samples , n_channels , lookback , n_assets = x . shape x_swapped = x . permute ( 0 , 2 , 3 , 1 ) # n_samples, lookback, n_assets, n_channels res = [ ] for i in range ( n_samples ) : all_hidden_ = self . cell ( x_swapped [ i ] ) [ 0 ] # lookback, n_assets, hidden_size res . append ( all_hidden_ . permute ( 2 , 0 , 1 ) ) # hidden_size, lookback, n_assets return torch . stack ( res )