neuroprob/likelihoods.py
def counts_to_onehot(self, counts):
        """
        Convert counts to one-hot vector representation. Adds the event dimension at the end.
        
        :param torch.tensor counts: spike counts of some tensor shape
        :param int max_counts: size of the event dimension (max_counts + 1)
        :returns: one-hot representation of shape (counts.shape, event)
        :rtype: torch.tensor
        """
        onehot = torch.zeros(*counts.shape, self.K, device=counts.device)
        onehot_ = onehot.view(-1, self.K)
        g = onehot_.shape[0]
        onehot_[np.arange(g), counts.flatten()[np.arange(g)].long()] = 1
        return onehot_.view(*onehot.shape)

        Convert counts to one-hot vector representation. Adds the event dimension at the end.
        
        :param torch.tensor counts: spike counts of some tensor shape
        :param int max_counts: size of the event dimension (max_counts + 1)
        :returns: one-hot representation of shape (counts.shape, event)
        :rtype: torch.tensor
        
Convert counts to one-hot vector representation. Adds the event dimension at the end.
Convert counts to one - hot vector representation . Adds the event dimension at the end .
def counts_to_onehot(self, counts):
        onehot = torch.zeros(*counts.shape, self.K, device=counts.device)
        onehot_ = onehot.view(-1, self.K)
        g = onehot_.shape[0]
        onehot_[np.arange(g), counts.flatten()[np.arange(g)].long()] = 1
        return onehot_.view(*onehot.shape)
def counts_to_onehot ( self , counts ) : onehot = torch . zeros ( * counts . shape , self . K , device = counts . device ) onehot_ = onehot . view ( - 1 , self . K ) g = onehot_ . shape [ 0 ] onehot_ [ np . arange ( g ) , counts . flatten ( ) [ np . arange ( g ) ] . long ( ) ] = 1 return onehot_ . view ( * onehot . shape )
Convert counts to one-hot vector representation.
Convert counts to one - hot vector representation .
"""
        Convert counts to one-hot vector representation. Adds the event dimension at the end.
        
        :param torch.tensor counts: spike counts of some tensor shape
        :param int max_counts: size of the event dimension (max_counts + 1)
        :returns: one-hot representation of shape (counts.shape, event)
        :rtype: torch.tensor
        """
one-hot representation of shape (counts.shape, event)
one - hot representation of shape ( counts . shape event )
torch.tensor
self
counts
spike counts of some tensor shape
spike counts of some tensor shape
max_counts
size of the event dimension (max_counts + 1)
size of the event dimension ( max_counts + 1 )