class_docstr: A regularizer which formulates a soft constraint on a maximum norm.
class_docstr_tok: ["A","regularizer","which","formulates","a","soft","constraint","on","a","maximum","norm","."]
docstr: Initialize the regularizer.
  
  :param weight:
      The relative weight of the regularization
  :param apply_only_once:
      Should the regularization be applied more than once after reset?
  :param dim:
      the dimension along which to calculate the Lp norm, cf. :func:`powersum_norm`
  :param p:
      the parameter $p$ of the Lp norm, cf. :func:`powersum_norm`
  :param power_norm:
      whether to use the $p$ power of the norm instead
  :param max_norm:
      the maximum norm until which no penalty is added
  :param kwargs:
      additional keyword-based parameters passed to :meth:`Regularizer.__init__`
docstr_tok: ["Initialize","the","regularizer",".",":","param","weight",":","The","relative","weight","of","the","regularization",":","param","apply_only_once",":","Should","the","regularization","be","applied","more","than","once","after","reset","?",":","param","dim",":","the","dimension","along","which","to","calculate","the","Lp","norm",",","cf",".",":","func",":","`","powersum_norm","`",":","param","p",":","the","parameter","$","p","$","of","the","Lp","norm",",","cf",".",":","func",":","`","powersum_norm","`",":","param","power_norm",":","whether","to","use","the","$","p","$","power","of","the","norm","instead",":","param","max_norm",":","the","maximum","norm","until","which","no","penalty","is","added",":","param","kwargs",":","additional","keyword-based","parameters","passed","to",":","meth",":","`","Regularizer.__init__","`"]
code: def __init__(
      self,
      *,
      # could be moved into kwargs, but needs to stay for experiment integrity check
      weight: float = 1.0,
      # could be moved into kwargs, but needs to stay for experiment integrity check
      apply_only_once: bool = False,
      # regularizer-specific parameters
      dim: Optional[int] = -1,
      p: float = 2.0,
      power_norm: bool = True,
      max_norm: float = 1.0,
      **kwargs,
  ):
      """
      Initialize the regularizer.
  
      :param weight:
          The relative weight of the regularization
      :param apply_only_once:
          Should the regularization be applied more than once after reset?
      :param dim:
          the dimension along which to calculate the Lp norm, cf. :func:`powersum_norm`
      :param p:
          the parameter $p$ of the Lp norm, cf. :func:`powersum_norm`
      :param power_norm:
          whether to use the $p$ power of the norm instead
      :param max_norm:
          the maximum norm until which no penalty is added
      :param kwargs:
          additional keyword-based parameters passed to :meth:`Regularizer.__init__`
      """
      super().__init__(
          weight=weight, apply_only_once=apply_only_once, **kwargs
      )
      self.dim = dim
      self.p = p
      self.max_norm = max_norm
      self.power_norm = power_norm
  
imports: from __future__ import annotations
  import warnings
  from abc import ABC, abstractmethod
  from typing import Any, ClassVar, Iterable, Mapping, Optional
  import torch
  from class_resolver import ClassResolver, normalize_string
  from torch import nn
  from torch.nn import functional
  from .utils import lp_norm, powersum_norm
label_desc: Use image node_id 1 to create a new NormLimitRegularizer object from inherited base classes: Regularizer with example: obj = NormLimitRegularizer()