analogvnn.nn.normalize.LPNorm#

Module Contents#

Classes#

LPNorm

Implements the row-wise Lp normalization function.

LPNormW

Implements the whole matrix Lp normalization function.

L1Norm

Implements the row-wise L1 normalization function.

L2Norm

Implements the row-wise L2 normalization function.

L1NormW

Implements the whole matrix L1 normalization function.

L2NormW

Implements the whole matrix L2 normalization function.

L1NormM

Implements the row-wise L1 normalization function with maximum absolute value of 1.

L2NormM

Implements the row-wise L2 normalization function with maximum absolute value of 1.

L1NormWM

Implements the whole matrix L1 normalization function with maximum absolute value of 1.

L2NormWM

Implements the whole matrix L2 normalization function with maximum absolute value of 1.

class analogvnn.nn.normalize.LPNorm.LPNorm(p: int, make_max_1=False)[source]#

Bases: analogvnn.nn.normalize.Normalize.Normalize, analogvnn.backward.BackwardIdentity.BackwardIdentity

Implements the row-wise Lp normalization function.

Variables:
  • p (int) – the pth power of the Lp norm.

  • make_max_1 (bool) – if True, the maximum absolute value of the output tensor will be 1.

__constants__ = ['p', 'make_max_1'][source]#
p: torch.nn.Parameter[source]#
make_max_1: torch.nn.Parameter[source]#
forward(x: torch.Tensor) torch.Tensor[source]#

Forward pass of row-wise Lp normalization function.

Parameters:

x (Tensor) – the input tensor.

Returns:

the output tensor.

Return type:

Tensor

class analogvnn.nn.normalize.LPNorm.LPNormW(p: int, make_max_1=False)[source]#

Bases: LPNorm

Implements the whole matrix Lp normalization function.

forward(x: torch.Tensor) torch.Tensor[source]#

Forward pass of whole matrix Lp normalization function.

Parameters:

x (Tensor) – the input tensor.

Returns:

the output tensor.

Return type:

Tensor

class analogvnn.nn.normalize.LPNorm.L1Norm[source]#

Bases: LPNorm

Implements the row-wise L1 normalization function.

class analogvnn.nn.normalize.LPNorm.L2Norm[source]#

Bases: LPNorm

Implements the row-wise L2 normalization function.

class analogvnn.nn.normalize.LPNorm.L1NormW[source]#

Bases: LPNormW

Implements the whole matrix L1 normalization function.

class analogvnn.nn.normalize.LPNorm.L2NormW[source]#

Bases: LPNormW

Implements the whole matrix L2 normalization function.

class analogvnn.nn.normalize.LPNorm.L1NormM[source]#

Bases: LPNorm

Implements the row-wise L1 normalization function with maximum absolute value of 1.

class analogvnn.nn.normalize.LPNorm.L2NormM[source]#

Bases: LPNorm

Implements the row-wise L2 normalization function with maximum absolute value of 1.

class analogvnn.nn.normalize.LPNorm.L1NormWM[source]#

Bases: LPNormW

Implements the whole matrix L1 normalization function with maximum absolute value of 1.

class analogvnn.nn.normalize.LPNorm.L2NormWM[source]#

Bases: LPNormW

Implements the whole matrix L2 normalization function with maximum absolute value of 1.