(self, x)
return x * self.constant.view(view)
Perform forward pass.

        Parameters
        ----------
        x : torch.Tensor
            N-dimensional tensor of shape (d_0, d_1, ..., d_{N-1})

        Returns
        -------
        weights : torch.Torch
            Tensor of shape (d_0, d_1, ..., d_{N-1}).
Perform forward pass.
Perform forward pass .
def forward(self, x):
        """Perform forward pass.

        Parameters
        ----------
        x : torch.Tensor
            N-dimensional tensor of shape (d_0, d_1, ..., d_{N-1})

        Returns
        -------
        weights : torch.Torch
            Tensor of shape (d_0, d_1, ..., d_{N-1}).

        """
        if self.dim_size != x.shape[self.dim_ix]:
            raise ValueError('The size of dimension {} is {} which is different than {}'.format(self.dim_ix,
                                                                                                x.shape[self.dim_ix],
                                                                                                self.dim_size))
        view = [self.dim_size if i == self.dim_ix else 1 for i in range(x.ndim)]
        return x * self.constant.view(view)
def forward ( self , x ) : if self . dim_size != x . shape [ self . dim_ix ] : raise ValueError ( 'The size of dimension {} is {} which is different than {}' . format ( self . dim_ix , x . shape [ self . dim_ix ] , self . dim_size ) ) view = [ self . dim_size if i == self . dim_ix else 1 for i in range ( x . ndim ) ] return x * self . constant . view ( view )