analogvnn.nn.normalize.Clamp
#
Module Contents#
Classes#
Implements the clamp normalization function with range [-1, 1]. |
|
Implements the clamp normalization function with range [0, 1]. |
- class analogvnn.nn.normalize.Clamp.Clamp[source]#
Bases:
analogvnn.nn.normalize.Normalize.Normalize
,analogvnn.backward.BackwardIdentity.BackwardIdentity
Implements the clamp normalization function with range [-1, 1].
- static forward(x: torch.Tensor)[source]#
Forward pass of the clamp normalization function with range [-1, 1].
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the output tensor.
- Return type:
Tensor
- backward(grad_output: Optional[torch.Tensor]) Optional[torch.Tensor] [source]#
Backward pass of the clamp normalization function with range [-1, 1].
- Parameters:
grad_output (Optional[Tensor]) – the gradient of the output tensor.
- Returns:
the gradient of the input tensor.
- Return type:
Optional[Tensor]
- class analogvnn.nn.normalize.Clamp.Clamp01[source]#
Bases:
analogvnn.nn.normalize.Normalize.Normalize
,analogvnn.backward.BackwardIdentity.BackwardIdentity
Implements the clamp normalization function with range [0, 1].
- static forward(x: torch.Tensor)[source]#
Forward pass of the clamp normalization function with range [0, 1].
- Parameters:
x (Tensor) – the input tensor.
- Returns:
the output tensor.
- Return type:
Tensor
- backward(grad_output: Optional[torch.Tensor]) Optional[torch.Tensor] [source]#
Backward pass of the clamp normalization function with range [0, 1].
- Parameters:
grad_output (Optional[Tensor]) – the gradient of the output tensor.
- Returns:
the gradient of the input tensor.
- Return type:
Optional[Tensor]