def CollectSufficientStatistics(self, neg=False):
    """Collect sufficient statistics for this layer."""
    h = self.hyperparams
    if not neg:
      self.state.sum(axis=1, target=self.suff_stats)
      if h.sparsity:
        sparsity_gradient = self.GetSparsityGradient()
        self.suff_stats.add_mult(sparsity_gradient, -self.batchsize)
    else:
      self.suff_stats.add_sums(self.state, axis=1, mult=-1.0)
    if not neg and h.sparsity:
      return self.means.sum()/self.means.shape[0]
Collect sufficient statistics for this layer.
deepnet/layer.py