Converts a None, list, np.ndarray, or torch.Tensor to np.ndarray

def _to_numpy(Z):
        """Converts a None, list, np.ndarray, or torch.Tensor to np.ndarray"""
        if isinstance(Z, list):
            return [Classifier._to_numpy(z) for z in Z]
        else:
            return Classifier._to_numpy(Z)