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

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