diff --git a/deel/torchlip/init.py b/deel/torchlip/init.py index d4285b0..688ccb2 100644 --- a/deel/torchlip/init.py +++ b/deel/torchlip/init.py @@ -26,6 +26,7 @@ # ===================================================================================== """ """ +import warnings import torch from .normalizers import bjorck_normalization @@ -57,6 +58,7 @@ def spectral_( eps_spectral (float): stopping criterion of iterative power method maxiter_spectral (int): maximum number of iterations for the power iteration """ + warnings.warn("spectral_ initialization is deprecated, use torch.nn.init.orthogonal_ instead") with torch.no_grad(): tensor.copy_( spectral_normalization( @@ -91,6 +93,7 @@ def bjorck_( maxiter_bjorck (int): maximum number of iterations for bjorck algorithm beta: Value to use for the :math:`\beta` parameter. """ + warnings.warn("bjorck_ initialization is deprecated, use torch.nn.init.orthogonal_ instead") with torch.no_grad(): spectral_tensor = spectral_normalization( tensor, None, eps=eps_spectral, maxiter=maxiter_spectral diff --git a/tests/utils_framework.py b/tests/utils_framework.py index a070176..e8aaa46 100644 --- a/tests/utils_framework.py +++ b/tests/utils_framework.py @@ -174,6 +174,7 @@ def __call__(self, **kwargs): Model = module_Unavailable_class compute_layer_sv = module_Unavailable_class OrthLinearRegularizer = module_Unavailable_class +SpectralInitializer = module_Unavailable_class MODEL_PATH = "model.h5" LIP_LAYERS = "torchlip_layers" @@ -591,13 +592,6 @@ def scaleDivAlpha(alpha): return 1.0 / (1 + 1.0 / alpha) -def SpectralInitializer(eps_spectral, eps_bjorck): - if eps_bjorck is None: - return partial(spectral_, eps_spectral=eps_spectral) - else: - return partial(bjorck_, eps_spectral=eps_spectral, eps_bjorck=eps_bjorck) - - class tAdd(torch.nn.Module): def __init__(self): super(tAdd, self).__init__()