def bincount(x, weights=None, minlength=None, assert_nonneg=False):
 if (x.ndim != 1):
  raise TypeError('Inputs must be of dimension 1.')
 if assert_nonneg:
  from theano.tensor.opt import Assert
  assert_op = Assert('Input to bincount has negative values!')
  x = assert_op(x, theano.tensor.all((x >= 0)))
 max_value = theano.tensor.cast((x.max() + 1), 'int64')
 if (minlength is not None):
  max_value = theano.tensor.maximum(max_value, minlength)
 if (weights is None):
  out = theano.tensor.zeros([max_value], dtype=x.dtype)
  out = theano.tensor.advanced_inc_subtensor1(out, 1, x)
 else:
  out = theano.tensor.zeros([max_value], dtype=weights.dtype)
  out = theano.tensor.advanced_inc_subtensor1(out, weights, x)
 return out

def bincount ( x , weights = None , minlength = None , assert_nonneg = False ) : if ( x . ndim != 1 ) : raise TypeError ( 'Inputs must be of dimension 1.' ) if assert_nonneg : from theano . tensor . opt import Assert assert_op = Assert ( 'Input to bincount has negative values!' ) x = assert_op ( x , theano . tensor . all ( ( x >= 0 ) ) ) max_value = theano . tensor . cast ( ( x . max ( ) + 1 ) , 'int64' ) if ( minlength is not None ) : max_value = theano . tensor . maximum ( max_value , minlength ) if ( weights is None ) : out = theano . tensor . zeros ( [ max_value ] , dtype = x . dtype ) out = theano . tensor . advanced_inc_subtensor1 ( out , 1 , x ) else : out = theano . tensor . zeros ( [ max_value ] , dtype = weights . dtype ) out = theano . tensor . advanced_inc_subtensor1 ( out , weights , x ) return out
count number of occurrences of each value in array of ints .