(self, x)
return weights
Predict weights.

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

        Returns
        -------
        weights : torch.Tensor
            Tensor of shape `(n_samples, n_assets)` representing the predicted weights.
Predict weights.
Predict weights .
def __call__(self, x):
        """Predict weights.

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

        Returns
        -------
        weights : torch.Tensor
            Tensor of shape `(n_samples, n_assets)` representing the predicted weights.

        """
        n_samples, n_channels, lookback, n_assets = x.shape

        if self.asset_ix not in set(range(n_assets)):
            raise IndexError('The selected asset index is out of range.')

        weights = torch.zeros((n_samples, n_assets), dtype=x.dtype, device=x.device)
        weights[:, self.asset_ix] = 1

        return weights
def __call__ ( self , x ) : n_samples , n_channels , lookback , n_assets = x . shape if self . asset_ix not in set ( range ( n_assets ) ) : raise IndexError ( 'The selected asset index is out of range.' ) weights = torch . zeros ( ( n_samples , n_assets ) , dtype = x . dtype , device = x . device ) weights [ : , self . asset_ix ] = 1 return weights