entropy#
- class diffsptk.Entropy(unit='nat')[source]#
- See this page for details. - Parameters:
- unit[‘bit’, ‘nat’, ‘dit’]
- Unit of entropy. 
 
 - forward(p)[source]#
- Compute entropy from probability sequence. - Parameters:
- pTensor [shape=(…, N)]
- Probability sequence. 
 
- Returns:
- hTensor [shape=(…,)]
- Entropy. 
 
 - Examples - >>> p = diffsptk.step(3) / 4 >>> p tensor([0.2500, 0.2500, 0.2500, 0.2500]) >>> entropy = diffsptk.Entropy("bit") >>> h = entropy(p) >>> h tensor(2.)