NoRegularizer

class NoRegularizer(weight: float = 1.0, apply_only_once: bool = False, parameters: Iterable[Parameter] | None = None)[source]

Bases: Regularizer

A regularizer which does not perform any regularization.

Used to simplify code.

Instantiate the regularizer.

Parameters:
  • weight (Tensor) – The relative weight of the regularization

  • apply_only_once (bool) – Should the regularization be applied more than once after reset?

  • parameters (Iterable[nn.Parameter] | None) – Specific parameters to track. if none given, it’s expected that your model automatically delegates to the update() function.

Attributes Summary

hpo_default

The default strategy for optimizing the no-op regularizer's hyper-parameters

Methods Summary

forward(x)

Compute the regularization term for one tensor.

update(*tensors)

Update the regularization term based on passed tensors.

Attributes Documentation

hpo_default: ClassVar[Mapping[str, Any]] = {}

The default strategy for optimizing the no-op regularizer’s hyper-parameters

Methods Documentation

forward(x: Tensor) Tensor[source]

Compute the regularization term for one tensor.

Parameters:

x (Tensor)

Return type:

Tensor

update(*tensors: Tensor) None[source]

Update the regularization term based on passed tensors.

Parameters:

tensors (Tensor)

Return type:

None