Skip to content

Commit

Permalink
orthoconv: added missing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaut.boissin committed Apr 5, 2022
1 parent 6420318 commit 12d088a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions deel/lip/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ def __init__(
kernel_constraint: Constraint function applied to the kernel matrix.
bias_constraint: Constraint function applied to the bias vector.
k_coef_lip: lipschitz constant to ensure.
regul_lorth: float : weight of the orthogonalization regularization.
This documentation reuse the body of the original keras.layers.Conv2D doc.
"""
Expand Down
25 changes: 21 additions & 4 deletions deel/lip/regularizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ def __init__(
flag_deconv=False,
) -> None:
"""
Lorth computation for 2D conv
Base class for Lorth regularization. Not meant to be used standalone.
Args:
kernel_shape: the shape of the kernel.
stride: int: stride used in the associated convolution
flag_deconv: flag used to indicate if the dimension of the output is
greater or lower than the dimnesion of the input.
"""
super(Lorth, self).__init__()
Expand Down Expand Up @@ -125,9 +129,14 @@ def __init__(
flag_deconv=False,
) -> None:
"""
Lorth computation for 2D conv
Lorth computation for 2D convolutions. Although this class allow to compute
the regularization term, it cannot be used as-is in a layer.
Args:
kernel_shape: the shape of the kernel.
stride: int: stride used in the associated convolution
flag_deconv: flag used to indicate if the dimension of the output is
greater or lower than the dimnesion of the input.
"""
super(Lorth2D, self).__init__(
Expand Down Expand Up @@ -209,10 +218,16 @@ def __init__(
flag_deconv=False,
) -> None:
"""
Regularize a conv kernel to be orthogonal (sigma min and max =1)
using Lorth regularizer
Regularize a conv kernel to be orthogonal (sigma min and max are equal to 1)
using Lorth regularizer.
Args:
kernel_shape: the shape of the kernel.
stride: int: stride used in the associated convolution
lambda_lorth: float : weight of the orthogonalization regularization.
dim: int: default 2: 1 for 1D convolutions, 2 for 2D convolutions.
flag_deconv: flag used to indicate if the dimension of the output is
greater or lower than the dimnesion of the input.
"""
super(LorthRegularizer, self).__init__()
Expand Down Expand Up @@ -257,6 +272,8 @@ def __init__(
minimizing W.W^T-Id
Args:
lambda_orth: float: weight applied to the regularization (must be
positive).
"""
super(OrthDenseRegularizer, self).__init__()
Expand Down

0 comments on commit 12d088a

Please sign in to comment.