(self, ary, out, stochastic=True)
return out
Binarizes input array

        Arguments:
            ary: tensor
            out: reference to output
            stochastic: stochastic or deterministic
Binarizes input array
Binarizes input array
def binarize(self, ary, out, stochastic=True):
        """
        Binarizes input array

        Arguments:
            ary: tensor
            out: reference to output
            stochastic: stochastic or deterministic
        """
        if stochastic:
            out[:] = (ary + 1)/2.0
            self.clip(out, 0, 1, out)
            prob = self.array(np.random.uniform(0, 1, size=ary.shape))
            self.less_equal(prob, out, out)
        else:
            self.greater_equal(ary, 0, out)
        out[:] = 2 * out - 1
        return out
def binarize ( self , ary , out , stochastic = True ) : if stochastic : out [ : ] = ( ary + 1 ) / 2.0 self . clip ( out , 0 , 1 , out ) prob = self . array ( np . random . uniform ( 0 , 1 , size = ary . shape ) ) self . less_equal ( prob , out , out ) else : self . greater_equal ( ary , 0 , out ) out [ : ] = 2 * out - 1 return out