def get_softmax_correct(self, labels, target):
        """
        target[i] = 1, iff labels[i] is correctly predicted; 0 otherwise.
        """
        assert labels.shape == (1, self.shape[1])
        assert target.shape == labels.shape
        if isinstance(labels, CUDAMatrix):
            err_code = _cudamat.get_softmax_correct(self.p_mat, labels.p_mat, target.p_mat)
        else:
            raise ValueError, "labels must be of type CUDAMatrix."

        if err_code:
            raise generate_exception(err_code)

        return target

        target[i] = 1, iff labels[i] is correctly predicted; 0 otherwise.
        
cudamat/cudamat.py