nupic.torch package

nupic.torch.compatibility

upgrade_to_masked_sparseweights(state_dict)[source]

Returns a new state dict with any “zero_weights” tensors converted to “zero_mask” tensors. (The “zero_weights” was a list of indices of zeroes in the weight tensor.)

nupic.torch.duty_cycle_metrics

binary_entropy(x)[source]

Calculate entropy for a list of binary random variables.

Parameters

x – (torch tensor) the probability of the variable to be 1.

Returns

entropy: (torch tensor) entropy, sum(entropy)

max_entropy(n, k)[source]

The maximum entropy we could get with n units and k winners.