(self, X_sample, y_sample, timestamps_sample, asset_names)
return X_sample_new, y_sample, timestamps_sample, asset_names
Perform transform.

        Parameters
        ----------
        X_sample : torch.Tensor
            Feature vector of shape `(n_channels, lookback, n_assets)`.

        y_sample : torch.Tensor
            Target vector of shape `(n_channels, horizon, n_assets)`.

        timestamps_sample : datetime
            Time stamp of the sample.

        asset_names
            Asset names corresponding to the last channel of `X_sample` and `y_sample`.

        Returns
        -------
        X_sample_new : torch.Tensor
            Feature vector of shape `(n_channels, lookback, n_assets)` scaled appropriately.

        y_sample : torch.Tesnor
            Same as input.

        timestamps_sample : datetime
            Same as input.

        asset_names
            Same as input.
Perform transform.
Perform transform .
def __call__(self, X_sample, y_sample, timestamps_sample, asset_names):
        """Perform transform.

        Parameters
        ----------
        X_sample : torch.Tensor
            Feature vector of shape `(n_channels, lookback, n_assets)`.

        y_sample : torch.Tensor
            Target vector of shape `(n_channels, horizon, n_assets)`.

        timestamps_sample : datetime
            Time stamp of the sample.

        asset_names
            Asset names corresponding to the last channel of `X_sample` and `y_sample`.

        Returns
        -------
        X_sample_new : torch.Tensor
            Feature vector of shape `(n_channels, lookback, n_assets)` scaled appropriately.

        y_sample : torch.Tesnor
            Same as input.

        timestamps_sample : datetime
            Same as input.

        asset_names
            Same as input.
        """
        n_channels = X_sample.shape[0]
        if n_channels != self.n_channels:
            raise ValueError('Expected {} channels in X, got {}'.format(self.n_channels, n_channels))

        X_sample_new = X_sample.clone()
        dtype, device = X_sample_new.dtype, X_sample_new.device

        center = torch.as_tensor(self.center, dtype=dtype, device=device)[:, None, None]
        scale = torch.as_tensor(self.scale, dtype=dtype, device=device)[:, None, None]

        X_sample_new.sub_(center).div_(scale)

        return X_sample_new, y_sample, timestamps_sample, asset_names
def __call__ ( self , X_sample , y_sample , timestamps_sample , asset_names ) : n_channels = X_sample . shape [ 0 ] if n_channels != self . n_channels : raise ValueError ( 'Expected {} channels in X, got {}' . format ( self . n_channels , n_channels ) ) X_sample_new = X_sample . clone ( ) dtype , device = X_sample_new . dtype , X_sample_new . device center = torch . as_tensor ( self . center , dtype = dtype , device = device ) [ : , None , None ] scale = torch . as_tensor ( self . scale , dtype = dtype , device = device ) [ : , None , None ] X_sample_new . sub_ ( center ) . div_ ( scale ) return X_sample_new , y_sample , timestamps_sample , asset_names