(self, weights, *args)
return (weights ** 2).sum(dim=1)
Compute sum of squared weights.

        Parameters
        ----------
        weights : torch.Tensor
            Tensor of shape `(n_samples, n_assets)` representing the predicted weights by our portfolio optimizer.

        args : list
            Additional arguments. Just used for compatibility. Not used.

        Returns
        -------
        torch.Tensor
            Tensor of shape `(n_samples,)` representing the per sample sum of squared weights.

        Notes
        -----
        If single asset then equal to `1`. If equally weighted portfolio then `1/N`.
Compute sum of squared weights.
Compute sum of squared weights .
def __call__(self, weights, *args):
        """Compute sum of squared weights.

        Parameters
        ----------
        weights : torch.Tensor
            Tensor of shape `(n_samples, n_assets)` representing the predicted weights by our portfolio optimizer.

        args : list
            Additional arguments. Just used for compatibility. Not used.

        Returns
        -------
        torch.Tensor
            Tensor of shape `(n_samples,)` representing the per sample sum of squared weights.

        Notes
        -----
        If single asset then equal to `1`. If equally weighted portfolio then `1/N`.

        """
        return (weights ** 2).sum(dim=1)
def __call__ ( self , weights , * args ) : return ( weights ** 2 ) . sum ( dim = 1 )