def dropout(self, dropprob, val=0.0):
        """
        Drop entries in this matrix uniformly randomly with given probability
        and set the dropped out unit to state val.
        """
        err_code = _cudamat.dropout(CUDAMatrix.rnd_state_p, self.p_mat,
                                    ct.c_float(dropprob), ct.c_float(val))
        if err_code:
            raise generate_exception(err_code)

        return self

        Drop entries in this matrix uniformly randomly with given probability
        and set the dropped out unit to state val.
        
cudamat/cudamat.py